annotate mqppep_anova_script.Rmd @ 4:0ab632432798 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 1c1dbc5a9838e5cd45724b6e53246eb80437e1f1
author galaxyp
date Tue, 14 Feb 2023 17:37:11 +0000
parents 6f51e262d84d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1 ---
d9b68bedbc91 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"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3 author:
d9b68bedbc91 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]"
d9b68bedbc91 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]"
d9b68bedbc91 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]"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
7 date:
d9b68bedbc91 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
1023fa7bd75f 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
2276e88d5a1f 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
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
11 output:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
12 pdf_document:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
13 toc: true
1
2276e88d5a1f 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
d9b68bedbc91 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
16 dev: pdf
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
17 includes:
2276e88d5a1f 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
2276e88d5a1f 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
2276e88d5a1f 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
2276e88d5a1f 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
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
22 params:
d9b68bedbc91 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"
d9b68bedbc91 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"
d9b68bedbc91 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"
d9b68bedbc91 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]
d9b68bedbc91 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]$"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
28 regexSampleGrouping: "\\d+"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
29 groupFilterPatterns: ".+"
2276e88d5a1f 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]
2276e88d5a1f 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]
2276e88d5a1f 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]
2276e88d5a1f 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]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
34
2276e88d5a1f 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?
2276e88d5a1f 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`)
2276e88d5a1f 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`)
2276e88d5a1f 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`)
2276e88d5a1f 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?
2276e88d5a1f 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`)
2276e88d5a1f 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]
2276e88d5a1f 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
2276e88d5a1f 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)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
44 firstDataColumn: "^Intensity[^_]"
2276e88d5a1f 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?
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
46 meanPercentile: 50
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
47 #meanPercentile: 1
2276e88d5a1f 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?
2276e88d5a1f 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
2276e88d5a1f 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
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
51 imputedDataFilename: "test-data/imputedDataFilename.txt"
1
2276e88d5a1f 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
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
53 imputedQNLTDataFile: "test-data/imputedQNLTDataFile.txt"
1
2276e88d5a1f 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
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
55 anovaKseaMetadata: "test-data/anovaKseaMetadata.txt"
1
2276e88d5a1f 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
d9b68bedbc91 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
2276e88d5a1f 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
d9b68bedbc91 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
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
61 minQuality: 0
2276e88d5a1f 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
2276e88d5a1f 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]
2276e88d5a1f 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)
2276e88d5a1f 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
2276e88d5a1f 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]
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
68 kseaMinSubstrateCount: 1
2276e88d5a1f 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?
2276e88d5a1f 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
2276e88d5a1f 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
2276e88d5a1f 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.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
73 kseaUseAbsoluteLog2FC: TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
74 #kseaUseAbsoluteLog2FC: FALSE
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
76 intensityMinValuesPerGroup: 1
2276e88d5a1f 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)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
78 intensityHeatmapRows: 50
2276e88d5a1f 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
2276e88d5a1f 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]
2276e88d5a1f 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)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
82 correlateSubstrates: TRUE
2276e88d5a1f 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
4
0ab632432798 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 1c1dbc5a9838e5cd45724b6e53246eb80437e1f1
galaxyp
parents: 3
diff changeset
84 filterCovVarGT1: FALSE
1
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
86 ppepTruncN: 10
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
88 subgeneTruncN: 10
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
90 substTruncN: 20
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
92 boxPlotVarWidth: TRUE
2276e88d5a1f 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
94 boxPlotNotch: TRUE
2276e88d5a1f 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
2276e88d5a1f 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"
2276e88d5a1f 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"
2276e88d5a1f 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?
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
99 showEnrichedSubstrates: FALSE
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
100 # should row-scaling be applied to heatmaps: "none" or "row"
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
101 defaultHeatMapRowScaling: !r c("none", "row")[1]
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
102 # how missing values be displayed on heat maps: "NA" or " "
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
103 heatMapNAcellNote: !r c(" ", "NA")[1]
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
104 # how missing values be displayed on heat maps: "NA" or " "
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
105 heatMapNAgrey: "#D8D8D8"
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
106 # temporary hack
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
107 heatMapNAsubstitute: TRUE
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
108 # what color should be used for missing values be displayed on heat maps
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
109 heatMapNAcellColor: "grey15"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
110 # should debugging trace messages be printed?
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
111 printTraceMsgs: FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
112 # when debugging files are needed, set debugFileBasePath to the path
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
113 # to the directory where they should be written
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
114 debugFileBasePath: !r if (TRUE) NULL else "test-data"
4
0ab632432798 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 1c1dbc5a9838e5cd45724b6e53246eb80437e1f1
galaxyp
parents: 3
diff changeset
115 # should debugging nb/nbe messages be printed?
0ab632432798 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 1c1dbc5a9838e5cd45724b6e53246eb80437e1f1
galaxyp
parents: 3
diff changeset
116 printNBMsgs: FALSE
0ab632432798 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 1c1dbc5a9838e5cd45724b6e53246eb80437e1f1
galaxyp
parents: 3
diff changeset
117 #printNBMsgs: TRUE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
118 ---
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
119
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
120 ```{r setup, include = FALSE, results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
121
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
122 # simple debug messaging
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
123 print_nb_messages <- params$printNBMsgs
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
124
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
125 nb <- if (!print_nb_messages) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
126 function(...) invisible()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
127 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
128 function(..., f = cat) f("\n$\\exists{}\\supset\\forall{}$", ...)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
129 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
130
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
131 nbe <- if (!print_nb_messages) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
132 function(...) invisible()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
133 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
134 function(..., f = cat, file = stderr()) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
135 cat(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
136 stringi::stri_unescape_unicode("\nN.B. \\u2203\\u2283\\u2200"),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
137 ...,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
138 file = file
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
139 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
140 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
141 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
142
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
143 #ref for debugging: https://yihui.org/tinytex/r/#debugging
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
144 options(tinytex.verbose = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
145
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
146 # ref for parameterizing Rmd document: https://stackoverflow.com/a/37940285
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
147 # ref for top and bottom struts: https://tex.stackexchange.com/a/50355
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
148 knitr::opts_chunk$set(echo = FALSE, fig.dim = c(9, 10), dpi = 300)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
149
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
150 # freeze the random number generator so the same results will be produced
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
151 # from run to run
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
152 set.seed(28571)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
153
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
154 ### LIBRARIES
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
155
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
156 if (print_nb_messages) nbe("library(gplots)")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
157 library(gplots)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
158 if (print_nb_messages) nbe("library(caret)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
159 # load caret for nearZeroVar
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
160 if (print_nb_messages) nbe("Please ignore any messages about systemd.\n")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
161 library(caret)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
162 if (print_nb_messages) nbe("library(DBI)")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
163 library(DBI)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
164 if (print_nb_messages) nbe("library(RSQLite)")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
165 library(RSQLite)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
166 if (print_nb_messages) nbe("library(sqldf)\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
167 # Suppress "Warning: no DISPLAY variable so Tk is not available"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
168 suppressWarnings(suppressMessages(library(sqldf)))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
169
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
170 # required but not added to search list:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
171 # - DBI
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
172 # - RSQLite
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
173 # - ggplot2
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
174 # - knitr
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
175 # - latex2exp
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
176 # - preprocessCore
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
177 # - reshape2
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
178 # - vioplot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
179
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
180 ### CONSTANTS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
181
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
182 const_boxplot_fill <- "grey94"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
183 const_ksea_astrsk_kinases <- 1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
184 const_ksea_nonastrsk_kinases <- 2
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
185 const_ksea_all_kinases <- 3
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
186 const_log10_e <- log10(exp(1))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
187 const_stripchart_cex <- 0.5
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
188 const_stripchart_jitter <- 0.3
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
189 const_table_anchor_bp <- "bp"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
190 const_table_anchor_ht <- "ht"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
191 const_table_anchor_p <- "p"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
192 const_table_anchor_t <- "t"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
193 const_table_anchor_tbp <- "tbp"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
194
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
195
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
196 ### GLOBAL VARIABLES (params)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
197
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
198 ## functions to process params
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
199
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
200 is_string_null_or_empty <- function(x) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
201 # N. B. non-strings are intentionally treated as NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
202 if (is.null(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
203 TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
204 else if (!is.character(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
205 TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
206 else x == ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
207 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
208
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
209 ##' Catch *and* save both errors and warnings, and in the case of
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
210 ##' a warning, also keep the computed result.
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
211 ##' return result as list(value = ..., warning = ...)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
212 ##' - value will be:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
213 ##' - the result if no exception is thrown
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
214 ##' - the exception if an exception is caught
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
215 ##' - warning will be a string except perhaps when warning argument is not NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
216 ##'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
217 ##' adapted from `demo(error.catching)`
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
218 ##'
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
219 ##' @title tryCatch both warnings (with value) and errors
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
220 ##' @param expr an \R expression to evaluate
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
221 ##' @return a list with 'value' and 'warning', where
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
222 ##' 'value' may be an error caught.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
223 ##' @author Martin Maechler;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
224 ##' Copyright (C) 2010-2012 The R Core Team
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
225 try_catch_w_e <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
226 function(expr, error = function(e) e, warning = NULL) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
227 wrn <- NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
228 # warning handler
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
229 w_handler <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
230 if (is.function(warning))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
231 warning
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
232 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
233 function(w) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
234 wrn <<- w
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
235 invokeRestart("muffleWarning")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
236 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
237 e_handler <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
238 if (is.function(error))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
239 error
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
240 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
241 function(e) e
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
242 # return result as list(value = ..., warning = ...)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
243 # - value will be:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
244 # - the result if no exception is thrown
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
245 # - the exception if an exception is caught
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
246 list(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
247 value = withCallingHandlers(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
248 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
249 expr,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
250 error = e_handler
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
251 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
252 warning = w_handler
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
253 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
254 warning = wrn
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
255 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
256 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
257
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
258 see_kvp <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
259 function(format, key, value, suffix = "") {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
260 if (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
261 !all(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
262 is.character(format),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
263 is.character(key),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
264 is.character(value),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
265 is.character(suffix)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
266 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
267 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
268 cat("all arguments to see_kvp should be character")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
269 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
270 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
271 result <- sprintf(format, value)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
272 if (length(result) > 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
273 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
274 "%s = c(%s)%s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
275 whack_underscores(key),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
276 paste(result, collapse = ", "),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
277 suffix
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
278 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
279 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
280 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
281 "%s = %s%s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
282 key,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
283 result,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
284 suffix
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
285 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
286 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
287 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
288
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
289 see_logical <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
290 function(x, suffix = "", xprssn = deparse1(substitute(x))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
291 result <- as.character(as.logical(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
292 # handle NAs and NaNs
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
293 result[is.na(result)] <- "NA"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
294 see_kvp(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
295 format = "%s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
296 key = xprssn,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
297 value = result,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
298 suffix = suffix
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
299 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
300 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
301
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
302 see_numeric <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
303 function(x, suffix = "", digits = 3, xprssn = deparse1(substitute(x))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
304 if (is.numeric(digits) && is.numeric(x)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
305 digits <- as.integer(digits)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
306 digits <- min(16, max(0, digits))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
307 format <- paste0("%0.", as.character(digits), "g")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
308 result <- sprintf(format, x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
309 see_kvp(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
310 format = "%s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
311 key = xprssn,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
312 value = result,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
313 suffix = suffix
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
314 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
315 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
316 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
317
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
318 see_character <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
319 function(x, suffix = "", xprssn = deparse1(substitute(x))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
320 if (is.character(x)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
321 see_kvp(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
322 format = "%s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
323 key = xprssn,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
324 value = sprintf("\"%s\"", x),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
325 suffix = suffix
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
326 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
327 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
328 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
329
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
330 see_variable <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
331 function(x, suffix = "", digits = 3, xprssn = deparse1(substitute(x))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
332 if (is.character(x)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
333 see_character(x, suffix, xprssn)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
334 } else if (is.numeric(x)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
335 see_numeric(x, suffix, digits, xprssn)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
336 } else if (is.logical(x)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
337 see_logical(x, suffix, xprssn)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
338 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
339 f <- file("")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
340 sink(f)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
341 str(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
342 msg <- paste(readLines(f), collapse = "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
343 sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
344 close(f)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
345 paste0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
346 "see_variable - str(",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
347 xprssn,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
348 "):\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
349 msg, "\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
350 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
351 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
352 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
353
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
354 divert_warnings <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
355 function(expr, classes = "warning") {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
356 withCallingHandlers(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
357 expr,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
358 warning = function(w) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
359 cat(" divert_warnings: ", w$message, "\n", file = stderr())
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
360 if (inherits(w, classes))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
361 tryInvokeRestart("muffleWarning")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
362 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
363 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
364 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
365
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
366 # ref: https://tug.org/texinfohtml/latex2e.html
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
367 # LaTeX sets aside the following characters for special purposes.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
368 # For example, the percent sign % is for comments.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
369 # They are called reserved characters or special characters.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
370 # They are all discussed elsewhere in this manual.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
371 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
372 # $ % & { } _ ~ ^ \ #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
373 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
374 # If you want a reserved character to be printed as itself, in the text body
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
375 # font, for all but the final three characters in that list simply put
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
376 # a backslash \ in front of the character.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
377 # Thus, typing \$1.23 will produce $1.23 in your output.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
378 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
379 # As to the last three characters, to get a tilde in the text body font,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
380 # use \~{} (omitting the curly braces would result in the next character
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
381 # receiving a tilde accent).
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
382 # Similarly, to get a text body font circumflex use \^{}.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
383 # To get a backslash in the font of the text body enter \textbackslash{}.
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
384 whack_math <- if (TRUE) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
385 function(v) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
386 v <- as.character(v)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
387 w <- v
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
388 w <- gsub("\\", "\\textbackslash ", v, fixed = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
389 w <- Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
390 f = function(l, r) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
391 ptrn <- paste0("\\", r)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
392 for (i in seq_along(l)) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
393 if (!grepl(ptrn, l[i], fixed = TRUE)) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
394 l[i] <- gsub(r, ptrn, l[i], fixed = TRUE)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
395 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
396 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
397 l
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
398 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
399 x = c("#", "$", "%", "&", "{", "}", "_"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
400 init = w
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
401 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
402 w <- gsub("^", "\\^{}", w, fixed = TRUE)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
403 w <- gsub("\\textbackslash \\_", "\\_", w, fixed = TRUE)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
404 return(w)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
405 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
406 } else {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
407 function(v) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
408 v <- as.character(v)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
409 w <- v
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
410 w <- gsub("\\", "\\textbackslash ", v, fixed = TRUE)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
411 w <- Reduce(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
412 f = function(l, r) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
413 if (length(l) > 1) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
414 cat("whack_math: deparse1(v) = `", deparse1(v), "`\n",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
415 file = stderr())
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
416 cat("whack_math: v = `", v, "`\n", file = stderr())
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
417 cat(" Reduce f: l = `", l,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
418 "` r = `", r,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
419 "`\n", file = stderr()
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
420 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
421 divert_warnings(grepl(r, l, fixed = TRUE))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
422 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
423 ptrn <- paste0("\\", r)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
424 cat("ptrn: `", ptrn, "`\n", file = stderr())
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
425 for (i in seq_along(l)) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
426 cat(" before l[i] = ", l[i], "\n", file = stderr())
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
427 if (!grepl(ptrn, l[i], fixed = TRUE)) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
428 l[i] <- gsub(r, ptrn, l[i], fixed = TRUE)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
429 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
430 cat(" after l[i] = ", l[i], "\n", file = stderr())
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
431 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
432 l
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
433 },
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
434 x = c("#", "$", "%", "&", "{", "}", "_"),
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
435 init = w
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
436 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
437 w <- gsub("^", "\\^{}", w, fixed = TRUE)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
438 w <- gsub("\\textbackslash \\_", "\\_", w, fixed = TRUE)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
439 return(w)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
440 if (all(v == w))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
441 v
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
442 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
443 paste0("\\texttt{", w, "}")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
444 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
445 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
446 whack_underscores <- whack_math
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
447
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
448 ## dump params to stderr (remove this eventually)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
449
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
450 if (FALSE) nbe(see_variable(params))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
451
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
452 ## unlist params for eventual output
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
453
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
454 param_unlist <- unlist(as.list(params))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
455
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
456 # no need to whack underscores and dollars because this is verbatim
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
457 param_df <- data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
458 parameter = paste0("\\verb@", names(param_unlist), "@"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
459 value = paste0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
460 "\n\\begin{tiny}\n\\verb@",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
461 param_unlist,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
462 "@\n\\end{tiny}"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
463 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
464 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
465 param_df <- data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
466 parameter = names(param_unlist),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
467 value = param_unlist
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
468 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
469 param_df <- param_df[order(param_df$parameter), ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
470
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
471 ## general output control
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
472
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
473 debug_file_base_path <- params$debugFileBasePath
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
474 print_trace_messages <- params$printTraceMsgs
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
475 show_enriched_substrates <- params$showEnrichedSubstrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
476 boxplot_varwidth <- params$boxPlotVarWidth
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
477 boxplot_notch <- params$boxPlotNotch
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
478
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
479 ## parameters for static data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
480
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
481 kinase_name_uprt_lut_bz2 <- params$kinaseNameUprtLutBz2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
482 kinase_uprt_desc_lut_bz2 <- params$kinaseUprtDescLutBz2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
483
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
484 ## parameters for input file
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
485
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
486 preproc_db <- params$preprocDb
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
487 alpha_file <- params$alphaFile
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
488 input_file <- params$inputFile
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
489
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
490 # First data column - ideally, this could be detected via
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
491 # regexSampleNames, but for now leave it as is.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
492 first_data_column <- params$firstDataColumn
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
493 fdc_is_integer <- is.integer(first_data_column)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
494 if (fdc_is_integer) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
495 first_data_column <- as.integer(params$firstDataColumn)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
496 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
497
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
498 ## parameters for output files
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
499
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
500 ksea_app_prep_db <- params$kseaAppPrepDb
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
501 imputed_data_filename <- params$imputedDataFilename
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
502 imp_qn_lt_data_filenm <- params$imputedQNLTDataFile
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
503 anova_ksea_mtdt_file <- params$anovaKseaMetadata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
504
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
505 ## parameters for imputation
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
506
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
507 # Imputation method, should be one of
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
508 # "random", "group-median", "median", or "mean"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
509 imputation_method <- params$imputationMethod
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
510
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
511 # Selection of percentile of logvalue data to set the mean for random number
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
512 # generation when using random imputation
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
513 mean_percentile <- params$meanPercentile / 100.0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
514
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
515 # deviation adjustment-factor for random values; real number.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
516 sd_percentile <- params$sdPercentile
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
517
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
518 ## parameters for group parsing and filtering
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
519
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
520 # Regular expression of Sample Names, e.g., "\\.(\\d+)[A-Z]$"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
521 regex_sample_names <- params$regexSampleNames
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
522 # Regular expression to extract Sample Grouping from Sample Name;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
523 # if error occurs, compare smpl_trt vs. sample_name_matches
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
524 # to see if groupings/pairs line up
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
525 # e.g., "(\\d+)"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
526
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
527 regex_sample_grouping <- params$regexSampleGrouping
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
528 # What are the patterns for filtering sample groups?
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
529 # How should sample groups be filtered?
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
530 # - none: do not filter
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
531 # - include: include sample groups matching filter
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
532 # - exclude: include sample groups not matching filter
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
533
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
534 sample_group_filter <- params$groupFilter
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
535 if (grepl("f", params$groupFilterMode, fixed = TRUE)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
536 sample_group_filter_perl <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
537 sample_group_filter_fixed <- TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
538 } else if (grepl("p", params$groupFilterMode, fixed = TRUE)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
539 sample_group_filter_perl <- TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
540 sample_group_filter_fixed <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
541 } else { # normal regex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
542 sample_group_filter_perl <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
543 sample_group_filter_fixed <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
544 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
545
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
546 sample_group_filter_nocase <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
547 grepl("i", params$groupFilterMode, fixed = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
548
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
549 # What PCRE patterns should be included or excluded
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
550 group_filter_patterns_csv <- params$groupFilterPatterns
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
551 sample_group_filter_patterns <- strsplit(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
552 x = group_filter_patterns_csv,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
553 split = ",",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
554 fixed = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
555 )[[1]]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
556
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
557 ## parameters for hypothesis testing
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
558
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
559 one_way_all_categories_fname <- params$oneWayManyCategories
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
560
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
561 one_way_all_categories <- try_catch_w_e(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
562 match.fun(one_way_all_categories_fname))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
563
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
564 if (!is.function(one_way_all_categories$value)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
565 write("fatal error for parameter oneWayManyCategories:", stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
566 write(one_way_all_categories$value$message, stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
567 if (sys.nframe() > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
568 cat("Cannot continue and quit() failed. Goodbye.")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
569 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
570 quit(save = "no", status = 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
571 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
572 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
573
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
574 one_way_all_categories <- one_way_all_categories$value
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
575
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
576 one_way_two_categories_fname <- params$oneWayManyCategories
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
577 one_way_two_categories <- try_catch_w_e(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
578 match.fun(one_way_two_categories_fname))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
579 if (!is.function(one_way_two_categories$value)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
580 cat("fatal error for parameter oneWayTwoCategories: \n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
581 cat(one_way_two_categories$value$message, fill = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
582 if (sys.nframe() > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
583 cat("Cannot continue and quit() failed. Goodbye.")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
584 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
585 quit(save = "no", status = 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
586 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
587 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
588 one_way_two_categories <- one_way_two_categories$value
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
589
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
590 ## parameters for KSEA
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
591
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
592 ksea_cutoff_statistic <- params$kseaCutoffStatistic
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
593 ksea_cutoff_threshold <- params$kseaCutoffThreshold
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
594 ksea_min_substrate_count <- params$kseaMinSubstrateCount
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
595
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
596 ## parameters for global variables consumed by functions
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
597
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
598 # intensityHeatmapCriteria: !r c("na_count", "p_value")[2] # TODO switch to 1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
599 # TODO Validate within list
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
600 g_intensity_hm_criteria <- params$intensityHeatmapCriteria
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
601 if (is_string_null_or_empty(g_intensity_hm_criteria)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
602 cat("invalid intensityHeatmapCriteria parameter (must be string)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
603 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
604 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
605 switch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
606 g_intensity_hm_criteria,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
607 "quality" = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
608 "na_count" = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
609 "p_value" = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
610 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
611 with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
612 params,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
613 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
614 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
615 "invalid %s (must be %s)",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
616 see_variable(intensityHeatmapCriteria),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
617 "one of quality or na_count or p_value"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
618 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
619 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
620 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
621 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
622 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
623 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
624
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
625 g_default_heatmap_row_scaling <-
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
626 params$defaultHeatMapRowScaling
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
627 if (
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
628 !is.character(g_default_heatmap_row_scaling) ||
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
629 !(g_default_heatmap_row_scaling %in% c("row", "none"))
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
630 ) {
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
631 cat("invalid defaultHeatMapRowScaling (must be 'row' or 'none')")
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
632 knitr::knit_exit()
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
633 }
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
634
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
635 # intensityHeatmapRows: 50
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
636 # TODO Validate >> 0 < 75
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
637 g_intensity_hm_rows <- params$intensityHeatmapRows
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
638 if (!is.integer(g_intensity_hm_rows) || g_intensity_hm_rows < 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
639 cat("invalid intensityHeatmapRows (must be integer > 0)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
640 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
641 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
642
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
643 g_intensity_min_per_class <- params$intensityMinValuesPerGroup
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
644 if (!is.integer(g_intensity_min_per_class) || g_intensity_min_per_class < 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
645 cat("invalid intensityMinValuesPerGroup (must be integer > -1")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
646 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
647 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
648 g_correlate_substrates <- params$correlateSubstrates
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
649 if (is.na(as.logical(g_correlate_substrates))) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
650 cat("invalid correlateSubstrates (must be TRUE or FALSE)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
651 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
652 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
653 g_filter_cov_var_gt_1 <- params$filterCovVarGT1
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
654 if (is.na(as.logical(g_filter_cov_var_gt_1))) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
655 cat("invalid filterCovVarGT1 parameter (must be TRUE or FALSE)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
656 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
657 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
658
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
659 # TODO Validate >> 0 < 30
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
660 g_ppep_trunc_n <- params$ppepTruncN
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
661
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
662 # TODO Validate >> 0 < 30
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
663 g_subgene_trunc_n <- params$subgeneTruncN
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
664
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
665 # TODO Validate >> 0 < 30
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
666 g_sbstr_trunc_n <- params$substTruncN
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
667
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
668
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
669 ### OPERATORS
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
670
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
671 # Test for exclusion
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
672 # ref: https://www.reneshbedre.com/blog/in-operator-r.html
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
673 `%notin%` <- Negate(`%in%`)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
674
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
675 # Augmented assignment
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
676 # ref: https://www2.cs.arizona.edu/icon/refernce/infix2.htm#aug_assign
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
677 `%||:=%` <- function(lvalue, ...) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
678 pf <- parent.frame()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
679 rvalue <- Reduce(paste0, x = ..., init = lvalue)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
680 assign(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
681 x = as.character(substitute(lvalue)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
682 value = rvalue,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
683 pos = pf
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
684 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
685 invisible(rvalue)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
686 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
687 # Infix concatenation
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
688 `%||%` <- function(lvalue, rvalue) paste0(lvalue, rvalue)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
689
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
690
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
691 ### FUNCTIONS
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
692
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
693 no_op <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
694 function() {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
695 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
696 # this function is not used in this file and should be removed while
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
697 # factoring out reusable code
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
698 all_apply <- function(f, v, na_rm = TRUE, ...) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
699 Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
700 f = function(l, r) if (na_rm && is.na(r)) TRUE else l && r,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
701 x = sapply(X = v, FUN = f, ...),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
702 init = TRUE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
703 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
704 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
705
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
706 write_debug_file <- function(data_frame) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
707 if (!is.null(debug_file_base_path)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
708 s_path <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
709 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
710 "%s/%s.txt",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
711 debug_file_base_path,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
712 deparse(substitute(data_frame))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
713 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
714 write.table(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
715 data_frame,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
716 file = s_path,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
717 sep = "\t",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
718 col.names = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
719 row.names = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
720 quote = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
721 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
722 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
723 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
724
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
725 # ref: http://adv-r.had.co.nz/Environments.html
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
726 # "When creating your own environment, note that you should set its parent
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
727 # environment to be the empty environment. This ensures you don't
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
728 # accidentally inherit objects from somewhere else."
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
729 # Caution: this prevents `with(my_env, expr)` from working when `expr`
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
730 # contains anything from the global environment, even operators!
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
731 # Hence, `x <- 1; get("x", new_env())` fails by design.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
732 new_env <- function() {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
733 new.env(parent = emptyenv())
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
734 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
735
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
736 # make apply readable for rows
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
737 row_apply <- function(x, fun, ..., simplify = TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
738 apply(x, MARGIN = 1, fun, ..., simplify = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
739 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
740
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
741 # make apply readable for columns
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
742 column_apply <- function(x, fun, ..., simplify = TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
743 apply(x, MARGIN = 2, fun, ..., simplify = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
744 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
745
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
746 ##' Produce a vector of boolean values whose i-th value is TRUE when any
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
747 ##' member of v matches the i-th membr of s, where i in 1:seq_len(length(s))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
748 ##'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
749 ##' @title Search multiple strings for matches of multiple substrings
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
750 ##' @param v a vector of substrings to match
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
751 ##' @param s a vector of strings to search for matches
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
752 ##' @param ... additional arguments to grepl
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
753 ##' @return a list with keys in s and valuse that are vectors of elements of v
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
754 ##' @author Art Eschenlauer
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
755 ##' Copyright (C) 2022 Art Eschenlauer;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
756 ##' MIT License; https://en.wikipedia.org/wiki/MIT_License#License_terms
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
757 mgrepl <- function(v, s, ...) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
758 grpl_rslt <- rep_len(0, length(s))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
759 for (vi in v) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
760 grpl_rslt_v <- sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
761 X = s,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
762 FUN = function(t) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
763 Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
764 f = function(l, r) if (is.null(l)) r else c(l, r),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
765 x = sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
766 X = vi,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
767 FUN = function(f) grepl(f, t, ...)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
768 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
769 init = c()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
770 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
771 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
772 simplify = "array"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
773 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
774 grpl_rslt <- grpl_rslt + grpl_rslt_v
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
775 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
776 unname(grpl_rslt > 0)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
777 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
778
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
779 ##' Produce positions in a vector where succeeding value != current valus
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
780 ##'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
781 ##' @title Search vector for neighboring positions having different values
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
782 ##' @param v a vector of comparable numeric values (e.g. integers)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
783 ##' @return a vector of positions i where v[i] != v[i + 1]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
784 ##' @author Art Eschenlauer
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
785 ##' Copyright (C) 2022 Art Eschenlauer;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
786 ##' MIT License; https://en.wikipedia.org/wiki/MIT_License#License_terms
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
787 transition_positions <- function(v) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
788 Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
789 f = function(l, i) if ((i != 1) && (v[i - 1] != v[i])) c(l, i - 1) else l,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
790 x = seq_along(v)[-1:0],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
791 init = c()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
792 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
793 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
794
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
795 ### figure debug functions
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
796
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
797 cat_par_vector <- function(par_name, lbl = "", newlines = TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
798 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
799 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
800 "%spar(%s) = c(%s)%s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
801 lbl,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
802 par_name,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
803 paste(par(par_name), collapse = ", "),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
804 if (newlines) "\n\n" else ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
805 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
806 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
807 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
808
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
809 cat_margins <- function(lbl = NULL) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
810 for (p in c("fig", "fin", "mar", "mai", "omd", "omi", "oma"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
811 cat_par_vector(p, if (!is.null(lbl)) paste0(lbl, " ") else NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
812 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
813
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
814 cat_variable <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
815 function(x, suffix = "", digits = 3, force_str = FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
816 xprssn <- deparse1(substitute(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
817 if (force_str || is.matrix(x) || is.list(x) || is.data.frame(x)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
818 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
819 paste0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
820 "\n\\texttt{\\textbf{",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
821 whack_underscores(xprssn),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
822 "}} [",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
823 typeof(x),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
824 ",",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
825 mode(x),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
826 "] =\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
827 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
828 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
829 cat("\n\\begin{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
830 str(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
831 cat("\n\\end{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
832 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
833 cat("\n", see_variable(x, suffix, digits, xprssn))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
834 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
835 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
836
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
837 ### structure helper functions
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
838
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
839 # ref: staque.R - Icon-oriented stack and queue operations
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
840 # - https://gist.github.com/eschen42/917690355e53918b9e7ba7138a02d1f8
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
841 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
842 # sq_get(v):x produces the leftmost element of v and removes it from v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
843 # but produces NA if v is empty
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
844 sq_get <- function(v) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
845 if (length(v) == 0) return(NA)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
846 assign(as.character(substitute(v)), v[-1], parent.frame())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
847 return(v[1])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
848 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
849 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
850 # sq_put(v,x1,...,xn):v puts x1, x2, ..., xn onto the right end of v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
851 # producing v.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
852 # Values are pushed in order from left to right,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
853 # so xn becomes the last (rightmost) value on v.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
854 # sq_put(v) with no second argument does nothing.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
855 sq_put <- function(v, x = NA, ...) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
856 pf <- parent.frame()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
857 if (is.null(x)) return(pf$v)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
858 if (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
859 !(length(x) > 1) &&
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
860 !rlang::is_closure(x) &&
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
861 is.na(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
862 ) return(pf$v)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
863 assign(as.character(substitute(v)), c(v, x, ...), pf)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
864 pf[[as.character(substitute(v))]]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
865 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
866
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
867 ### numerical/statistical helper functions
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
868
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
869 any_nan <- function(x) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
870 !any(x == "NaN")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
871 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
872
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
873 # determine standard deviation of quantile to impute
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
874 sd_finite <- function(x) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
875 ok <- is.finite(x)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
876 sd(x[ok])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
877 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
878
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
879 # compute anova raw p-value
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
880 anova_func <- function(x, grouping_factor, one_way_f) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
881 subject <- data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
882 intensity = x
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
883 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
884 x_aov <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
885 one_way_f(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
886 formula = intensity ~ grouping_factor,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
887 data = subject
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
888 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
889 pvalue <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
890 if (identical(one_way_f, aov))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
891 summary(x_aov)[[1]][["Pr(>F)"]][1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
892 else
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
893 pvalue <- x_aov$p.value
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
894 pvalue
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
895 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
896
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
897 # This code adapted from matrixcalc::is.positive.definite
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
898 # Notably, this simply tests without calling stop()
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
899 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
900 # squash un-actionable cyclomatic_complexity warning
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
901 is_positive_definite <- function(x, tol = 1e-08) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
902 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
903 if (!is.matrix(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
904 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
905 if (!is.numeric(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
906 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
907 if (nrow(x) < 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
908 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
909 if (ncol(x) < 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
910 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
911 if (nrow(x) != ncol(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
912 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
913 sum_symm <- sum(x == t(x), na.rm = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
914 value_count <- Reduce("*", dim(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
915 if (sum_symm != value_count)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
916 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
917 eigenvalues <- eigen(x, only.values = TRUE)$values
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
918 n <- nrow(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
919 for (i in 1:n) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
920 if (abs(eigenvalues[i]) < tol) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
921 eigenvalues[i] <- 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
922 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
923 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
924 if (any(eigenvalues <= 0)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
925 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
926 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
927 return(TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
928 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
929
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
930 ### LaTeX functions
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
931
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
932 # Use this like print.data.frame, from which it is adapted:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
933 data_frame_table_latex <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
934 function(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
935 x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
936 # digits to pass to format.data.frame
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
937 digits = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
938 # TRUE -> right-justify columns; FALSE -> left-justify
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
939 right = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
940 # maximumn number of rows to print
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
941 max = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
942 # string with justification of each column
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
943 justification = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
944 # TRUE to center on page
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
945 centered = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
946 # optional caption
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
947 caption = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
948 # h(inline); b(bottom); t (top) or p (separate page)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
949 anchor = "h",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
950 # set underscore_whack to TRUE to escape underscores
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
951 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
952 # how to emit results
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
953 emit = cat
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
954 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
955 if (is.null(justification))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
956 justification <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
957 Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
958 f = paste,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
959 x = rep_len(if (right) "r" else "l", length(colnames(x)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
960 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
961 n <- length(rownames(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
962 if (length(x) == 0L) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
963 emit(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
964 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
965 # if n is one, use singular 'row', else use plural 'rows'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
966 ngettext(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
967 n,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
968 "data frame with 0 columns and %d row",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
969 "data frame with 0 columns and %d rows"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
970 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
971 n
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
972 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
973 "\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
974 sep = ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
975 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
976 } else if (n == 0L) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
977 emit("0 rows for:\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
978 latex_itemized_list(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
979 v = names(x),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
980 underscore_whack = underscore_whack
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
981 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
982 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
983 if (is.null(max))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
984 max <- getOption("max.print", 99999L)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
985 if (!is.finite(max)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
986 cat("Abend because: invalid 'max' / getOption(\"max.print\"): ", max)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
987 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
988 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
989 omit <- (n0 <- max %/% length(x)) < n
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
990 m <- as.matrix(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
991 format.data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
992 if (omit) x[seq_len(n0), , drop = FALSE] else x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
993 digits = digits,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
994 na.encode = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
995 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
996 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
997 emit(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
998 # h(inline); b(bottom); t (top) or p (separate page)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
999 paste0("\\begin{table}[", anchor, "]"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1000 "\\leavevmode",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1001 sep = "\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1002 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1003 if (!is.null(caption))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1004 emit(paste0(" \\caption{", caption, "}"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1005 if (centered) emit("\\centering\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1006 emit(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1007 paste(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1008 " \\begin{tabular}{",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1009 justification,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1010 "}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1011 sep = ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1012 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1013 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1014
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1015 # ref for top and bottom struts (\T and \B):
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1016 # https://tex.stackexchange.com/a/50355
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1017 if (!is.null(caption))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1018 emit("\\B \\\\\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1019 latex_table_row(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1020 v = colnames(m),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1021 extra = " \\T \\B",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1022 underscore_whack = underscore_whack
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1023 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1024 emit("\\hline \\\\\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1025 for (i in seq_len(length(m[, 1]))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1026 latex_table_row(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1027 v = m[i, ],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1028 underscore_whack = underscore_whack
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1029 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1030 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1031 emit(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1032 paste(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1033 " \\end{tabular}",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1034 "\\end{table}",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1035 sep = "\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1036 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1037 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1038 if (omit)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1039 emit(" [ reached 'max' / getOption(\"max.print\") -- omitted",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1040 n - n0, "rows ]\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1041 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1042 invisible(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1043 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1044
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1045 # Use this like print.data.frame, from which it is adapted:
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1046 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1047 # squash un-actionable cyclomatic_complexity warning
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1048 # squash un-actionable "no visible global for ..."
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1049 data_frame_tabbing_latex <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1050 function(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1051 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1052 x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1053 # vector of tab stops, in inches
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1054 tabstops,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1055 # vector of headings, registered with tab-stops
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1056 headings = colnames(x),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1057 # digits to pass to format.data.frame
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1058 digits = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1059 # maximumn number of rows to print
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1060 max = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1061 # optional caption
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1062 caption = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1063 # set underscore_whack to TRUE to escape underscores
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1064 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1065 # flag for landscape mode
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1066 landscape = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1067 # flag indicating that subsubsection should be used for caption
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1068 # rather than subsection
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1069 use_subsubsection_header = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1070 # character-size indicator; for possible values, see:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1071 # https://tug.org/texinfohtml/latex2e.html#Font-sizes
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1072 charactersize = "small",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1073 # set verbatim to TRUE to debug output
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1074 verbatim = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1075 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1076
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1077 hlinport <- if (landscape) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1078 function() cat("\\hlinlscp \\\\\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1079 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1080 function() cat("\\hlinport \\\\\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1081 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1082
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1083 tabstops_tex <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1084 Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1085 f = function(l, r) paste0(l, r),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1086 x = sprintf("\\hspace{%0.2fin}\\=", tabstops),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1087 init = ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1088 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1089
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1090 n <- length(rownames(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1091 if (length(x) == 0L) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1092 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1093 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1094 # if n is one, use singular 'row', else use plural 'rows'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1095 ngettext(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1096 n,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1097 "data frame with 0 columns and %d row",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1098 "data frame with 0 columns and %d rows"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1099 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1100 n
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1101 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1102 "\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1103 sep = ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1104 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1105 } else if (n == 0L) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1106 cat("0 rows for:\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1107 latex_itemized_list(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1108 v = names(x),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1109 underscore_whack = underscore_whack
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1110 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1111 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1112 if (is.null(max))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1113 max <- getOption("max.print", 99999L)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1114 if (!is.finite(max)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1115 cat("Abend because: invalid 'max' / getOption(\"max.print\"): ", max)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1116 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1117 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1118 omit <- (n0 <- max %/% length(x)) < n
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1119 m <- as.matrix(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1120 format.data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1121 if (omit) x[seq_len(n0), , drop = FALSE] else x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1122 digits = digits,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1123 na.encode = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1124 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1125 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1126 if (landscape)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1127 cat("\n\\begin{landscape}")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1128 tex_caption <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1129 if (!is.null(caption)) sprintf("\\captionof{table}{%s}\n", caption)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1130 else "\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1131 # build the column names, which have multiple lines when
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1132 # length(headings) is a multiple of the number of columns
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1133 column_names <- ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1134 while (length(headings) > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1135 my_row <- c()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1136 for (i in 1:(1 + length(tabstops))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1137 my_field <- sq_get(headings)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1138 sq_put(my_row, if (is.na(my_field)) "" else my_field)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1139 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1140 column_names %||:=% latex_tabbing_row(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1141 v = my_row,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1142 underscore_whack = underscore_whack,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1143 action = paste0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1144 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1145 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1146
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1147 # Begin tabbing environment after beginning charactersize environment
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1148 if (verbatim) cat("\n\\begin{verbatim}")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1149 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1150 paste0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1151 "\n\\begin{", charactersize, "}", tex_caption,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1152 "\\begin{tabwrap}{", tabstops_tex, "}\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1153 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1154 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1155 # emit column names
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1156 cat(column_names)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1157 # emit hline
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1158 hlinport()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1159 for (i in seq_len(length(m[, 1]))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1160 my_row <- latex_tabbing_row(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1161 v = m[i, ],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1162 underscore_whack = underscore_whack,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1163 action = paste0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1164 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1165 if (FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1166 cat(my_row)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1167 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1168 cat(my_row)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1169 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1170 hlinport()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1171 if (omit)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1172 cat(" [ reached 'max' / getOption(\"max.print\") -- omitted",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1173 n - n0, "rows ]\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1174 # End charactersize environment after ending tabbing environment
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1175 cat(paste0("\\end{tabwrap}\n\\end{", charactersize, "}\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1176 if (verbatim) cat("\\end{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1177 if (landscape)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1178 cat("\\end{landscape}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1179 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1180 invisible(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1181 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1182
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1183 param_df_noexit <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1184 function(e = NULL) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1185 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1186 x = param_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1187 tabstops = c(1.75),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1188 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1189 caption = "Input parameters",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1190 verbatim = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1191 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1192 if (!is.null(e)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1193 sink(stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1194 cat("Caught fatal error:\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1195 str(e)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1196 sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1197 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1198 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1199
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1200 param_df_exit <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1201 function(e = NULL) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1202 param_df_noexit(e)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1203 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1204 exit(-1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1205 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1206
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1207 # exit with exit code (default 0) and optional msg
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1208 exit <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1209 function(code = 0, msg = NULL, use_stderr = FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1210 if (!is.null(msg)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1211 if (use_stderr) sink(stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1212 cat("\n\n", msg, "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1213 if (use_stderr) sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1214 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1215 q(save = "no", status = code)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1216 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1217
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1218 # make control sequences into printable latex sequences
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1219 latex_printable_control_seqs <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1220 function(s) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1221 s <- gsub("[\\]", "xyzzy_plugh", s)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1222 s <- gsub("[$]", "\\\\$", s)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1223 s <- gsub("xyzzy_plugh", "$\\\\backslash$", s)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1224 return(s)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1225 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1226 nolatex_verbatim <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1227 function(expr) eval(expr)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1228
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1229 error_knitrexit_stop <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1230 function(e) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1231 cat("Caught error:\n\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1232 str(e)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1233 knitr::knit_exit()
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1234 stop(e)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1235 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1236
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1237 latex_verbatim <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1238 function(expr) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1239 cat("\n\\begin{verbatim}\n___\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1240 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1241 expr = expr,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1242 error = param_df_exit,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1243 finally = cat("...\n\\end{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1244 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1245 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1246
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1247 latex_samepage <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1248 function(expr) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1249 cat("\n\\begin{samepage}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1250 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1251 expr = expr,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1252 error = param_df_exit,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1253 finally = cat("\n\\end{samepage}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1254 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1255 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1256
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1257 # return the result of invocation after showing parameters
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1258 # ref: https://www.r-bloggers.com/2013/08/a-new-r-trick-for-me-at-least/
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1259 latex_show_invocation <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1260 function(f, f_name = deparse1(substitute(f)), head_patch = FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1261 function(...) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1262 va <- list(...)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1263 my_rslt <- new_env()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1264 my_rslt$rslt <- NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1265 latex_verbatim(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1266 expr = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1267 cat(sprintf("\n .. Local variables for '%s':\n\n", f_name))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1268 str(va)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1269 if (!head_patch) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1270 # return this result
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1271 # ref:
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1272 # https://www.r-bloggers.com/2013/08/a-new-r-trick-for-me-at-least/
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1273 cat(sprintf("\n .. Invoking '%s'\n", f_name))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1274 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1275 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1276 cat("\n\\end{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1277 rslt <- do.call(f, va)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1278 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1279 error = param_df_exit,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1280 finally = cat("\n\\begin{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1281 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1282 cat(sprintf("\n .. '%s' returned:\n", f_name))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1283 str(rslt)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1284 my_rslt$rslt <- rslt
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1285 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1286 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1287 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1288 # return the result of invocation with the shown parameters
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1289 # ref: https://www.r-bloggers.com/2013/08/a-new-r-trick-for-me-at-least/
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1290 if (head_patch) my_rslt$rslt <- do.call(f, va)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1291 (my_rslt$rslt)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1292 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1293 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1294
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1295 latex_collapsed_vector <- function(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1296 collapse_string,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1297 v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1298 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1299 action = cat0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1300 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1301 v_sub <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1302 if (underscore_whack) whack_underscores(v) else v
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1303 action(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1304 paste0(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1305 v_sub,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1306 collapse = collapse_string
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1307 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1308 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1309 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1310
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1311 latex_itemized_collapsed <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1312 function(collapse_string, v, underscore_whack = TRUE) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1313 cat("\\begin{itemize}\n\\item ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1314 latex_collapsed_vector(collapse_string, v, underscore_whack)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1315 cat("\n\\end{itemize}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1316 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1317
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1318 latex_itemized_list <- function(v, underscore_whack = TRUE) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1319 latex_itemized_collapsed("\n\\item ", v, underscore_whack)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1320 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1321
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1322 latex_enumerated_collapsed <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1323 function(collapse_string, v, underscore_whack = TRUE) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1324 cat("\\begin{enumerate}\n\\item ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1325 latex_collapsed_vector(collapse_string, v, underscore_whack)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1326 cat("\n\\end{enumerate}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1327 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1328
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1329 latex_enumerated_list <- function(v) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1330 latex_enumerated_collapsed("\n\\item ", v)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1331 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1332
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1333 latex_table_row <- function(v, extra = "", underscore_whack = TRUE) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1334 latex_collapsed_vector(" & ", v, underscore_whack)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1335 cat(extra)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1336 cat(" \\\\\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1337 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1338
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1339 latex_tabbing_row <- function(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1340 v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1341 extra = "",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1342 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1343 action = cat0
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1344 ) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1345 # latex_collapsed_vector applies action to result of paste0;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1346 # by default, action = cat;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1347 # hence, a scalar string is assigned to v_collapsed
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1348 v_collapsed <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1349 latex_collapsed_vector(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1350 "} \\> \\tabfill{",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1351 v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1352 underscore_whack,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1353 action = paste0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1354 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1355 action(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1356 "\\tabfill{",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1357 v_collapsed,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1358 "}",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1359 extra,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1360 " \\\\\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1361 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1362 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1363
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1364 # N.B. use con = "" to emulate regular cat
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1365 fcat0 <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1366 function(..., sprtr = " ", cnnctn = file()) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1367 gsubfn::cat0(..., sep = sprtr, file = cnnctn)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1368 invisible(cnnctn)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1369 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1370
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1371 hypersub <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1372 function(s) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1373 hyper <- tolower(s)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1374 hyper <- gsub("[^a-z0-9]+", "-", hyper)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1375 hyper <- gsub("[-]+", "-", hyper)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1376 hyper <- gsub("[_]+", "-", hyper)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1377 hyper <- sub("^[-]", "", hyper)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1378 hyper <- sub("[-]$", "", hyper)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1379 return(hyper)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1380 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1381
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1382 table_href <- function(s = "offset", caption = "") {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1383 paste0("\\hyperlink{table.\\arabic{", s, "}}{Table \\arabic{", s, "}}")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1384 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1385
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1386 table_offset <- function(i = 0, s = "offset", new = FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1387 paste0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1388 if (new) paste0("\\newcounter{", s, "}\n") else "",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1389 "\\setcounter{", s, "}{\\value{table}}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1390 paste0(if (i > 0) rep(paste0("\\stepcounter{", s, "}"), i), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1391 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1392 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1393
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1394 a_section_header <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1395 function(s, prefix = "") {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1396 hyper <- hypersub(s)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1397 my_subsection_header <- sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1398 "\\hypertarget{%s}{\\%ssection{%s}\\label{%s}}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1399 hyper,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1400 prefix,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1401 gsub("_", "\\_", s, fixed = TRUE),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1402 hyper
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1403 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1404 my_subsection_header
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1405 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1406 section_header <- function(s) a_section_header(s, "")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1407 subsection_header <- function(s) a_section_header(s, "sub")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1408 subsubsection_header <- function(s) a_section_header(s, "subsub")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1409
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1410 ### SQLite functions
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1411
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1412 ddl_exec <- function(db, sql) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1413 discard <- DBI::dbExecute(conn = db, statement = sql)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1414 if (FALSE && discard != 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1415 need_newpage <- TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1416 if (need_newpage) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1417 need_newpage <<- FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1418 cat("\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1419 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1420 o_file <- stdout()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1421 cat("\n\\begin{verbatim}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1422 cat(sql, file = o_file)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1423 cat(sprintf("\n%d rows affected by DDL\n", discard), file = o_file)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1424 cat("\n\\end{verbatim}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1425 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1426 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1427
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1428 dml_no_rows_exec <- function(db, sql) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1429 discard <- DBI::dbExecute(conn = db, statement = sql)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1430 if (discard != 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1431 need_newpage <- TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1432 if (need_newpage) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1433 need_newpage <<- FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1434 cat("\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1435 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1436 cat("\n\\begin{verbatim}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1437 o_file <- stdout()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1438 cat(sql, file = o_file)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1439 cat(sprintf("\n%d rows affected by DML\n", discard), file = o_file)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1440 cat("\n\\end{verbatim}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1441 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1442 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1443
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1444 ### KSEA functions and helpers
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1445
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1446 #' The KSEA App Analysis (KSEA Kinase Scores Only)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1447 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1448 #' Compute KSEA kinase scores and statistics from phoshoproteomics data input
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1449 #' Adapted from KSEAapp::KSEA.Scores to allow retrieval of maximum log2(FC)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1450 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1451 #' Result is an R data.frame with column names
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1452 #' "Kinase.Gene", "mS", "Enrichment", "m", "z.score", "p.value", "FDR"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1453 #' "Please refer to the original Casado et al. publication for detailed
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1454 #' description of these columns and what they represent:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1455 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1456 #' - Kinase.Gene indicates the gene name for each kinase.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1457 #' - mS represents the mean log2(fold change) of all the
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1458 #' kinase's substrates.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1459 #' - Enrichment is the background-adjusted value of the kinase's mS.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1460 #' - m is the total number of detected substrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1461 #' from the experimental dataset for each kinase.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1462 #' - z.score is the normalized score for each kinase, weighted by
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1463 #' the number of identified substrates.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1464 #' - p.value represents the statistical assessment for the z.score.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1465 #' - FDR is the p-value adjusted for multiple hypothesis testing
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1466 #' using the Benjamini & Hochberg method."
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1467 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1468 #' @param ksdata the Kinase-Substrate dataset uploaded from the file
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1469 #' prefaced with "PSP&NetworKIN_"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1470 #' available from github.com/casecpb/KSEA/
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1471 #' @param px the experimental data file formatted as described in
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1472 #' the KSEA.Complete() documentation
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1473 #' @param networkin a binary input of TRUE or FALSE, indicating whether
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1474 #' or not to include NetworKIN predictions, where
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1475 #' \code{NetworKIN = TRUE}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1476 #' means include NetworKIN predictions
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1477 #' @param networkin_cutoff a numeric value between 1 and infinity setting
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1478 #' the minimum NetworKIN score
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1479 #' (this can be omitted if NetworKIN = FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1480 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1481 #' @return creates a new R data.frame with all the KSEA kinase
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1482 #' scores, along with each one's statistical
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1483 #' assessment, as described herein.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1484 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1485 #' @references
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1486 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1487 #' Casado et al. (2013) Sci Signal. 6(268):rs6
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1488 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1489 #' Hornbeck et al. (2015) Nucleic Acids Res. 43:D512-20
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1490 #'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1491 #' Horn et al. (2014) Nature Methods 11(6):603-4
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1492 #'
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1493 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1494 # squash un-actionable cyclomatic_complexity warning
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1495 ksea_scores <- function(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1496 # nolint end
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1497 # For human data, typically, ksdata = KSEAapp::ksdata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1498 ksdata,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1499
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1500 # Input data file having columns:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1501 # - Protein : abbreviated protein name
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1502 # - Gene : HUGO gene name
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1503 # - Peptide : peptide sequence without indications of phosphorylation
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1504 # - Reside.Both : position(s) of phosphorylation within Gene sequence
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1505 # - First letter designates AA that is modified
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1506 # - Numbers indicate position within Gene
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1507 # - Multiple values are separated by semicolons
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1508 # - p : p-value
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1509 # - FC : fold-change
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1510 px,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1511
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1512 # A binary input of TRUE or FALSE, indicating whether or not to include
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1513 # NetworKIN predictions
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1514 networkin,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1515
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1516 # A numeric value between 1 and infinity setting the minimum NetworKIN
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1517 # score (can be left out if networkin = FALSE)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1518 networkin_cutoff,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1519
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1520 # Minimum substrate count, necessary to adjust the p-value appropriately.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1521 minimum_substrate_count
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1522
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1523 ) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1524 if (FALSE) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1525 if (print_nb_messages) nbe("Output contents of `ksdata` table\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1526 cat_variable(ksdata)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1527 cat("\n\\clearpage\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1528 data_frame_tabbing_latex(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1529 x = ksdata[order(ksdata$GENE, ksdata$SUB_GENE), ],
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1530 tabstops = c(0.3, 0.3, 1.2, 0.3, 0.3, 0.3, 0.3,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1531 0.8, 0.3, 0.8, 0.3, 0.3, 0.3),
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1532 caption = "ksdata dump",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1533 use_subsubsection_header = FALSE
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1534 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1535 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1536 # no px$FC should be <= 0, but abs(px$FC) is used below as a precaution.
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1537 if (length(grep(";", px$Residue.Both)) == 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1538 # There are no Residue.Both entries having semicolons, so new is
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1539 # simply px except two columns are renamed and a column is added
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1540 # for log2(abs(fold-change))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1541 new <- px
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1542 colnames(new)[c(2, 4)] <- c("SUB_GENE", "SUB_MOD_RSD")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1543 new$log2_fc <- log2(abs(as.numeric(as.character(new$FC))))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1544 new <- new[complete.cases(new$log2_fc), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1545 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1546 # Split each row having semicolons in Residue.Both into rows that are
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1547 # duplicated in all respects except that each row has a single
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1548 # member of the set "split-on-semicolon-Residue.Both"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1549 px_double <- px[grep(";", px$Residue.Both), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1550 residues <- as.character(px_double$Residue.Both)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1551 residues <- as.matrix(residues, ncol = 1)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1552 split <- strsplit(residues, split = ";")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1553 # x gets count of residues in each row,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1554 # i.e., 1 + count of semicolons
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1555 x <- sapply(split, length)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1556 # Here is the set of split rows
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1557 px_single <- data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1558 Protein = rep(px_double$Protein, x),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1559 Gene = rep(px_double$Gene, x),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1560 Peptide = rep(px_double$Peptide, x),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1561 Residue.Both = unlist(split),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1562 p = rep(px_double$p, x),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1563 FC = rep(px_double$FC, x)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1564 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1565 # new first gets the split rows
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1566 new <- px[-grep(";", px$Residue.Both), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1567 # to new, append the rows that didn't need splitting in the first place
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1568 new <- rbind(new, px_single)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1569 # map Gene to SUB_GENE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1570 # map Residue.Both to SUB_MOD_RSD
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1571 colnames(new)[c(2, 4)] <- c("SUB_GENE", "SUB_MOD_RSD")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1572 # Eliminate any non-positive values to prevent introduction of
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1573 # infinite or NaN values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1574 new[(0 <= new$log2_fc), "log2_fc"] <- NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1575 # Because of preceding step, there is no need for abs in the next line
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1576 new$log2_fc <- log2(as.numeric(as.character(new$FC)))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1577 # Convert any illegal values from NaN to NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1578 new[is.nan(new$log2_fc), "log2_fc"] <- NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1579 # Eliminate rows having missing values (e.g., non-imputed data)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1580 new <- new[complete.cases(new$log2_fc), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1581 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1582 # At this point, new$log2_fc is signed according to which contrast has
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1583 # the greater intensity
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1584 # To take the magnitude into account without taking the direction into
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1585 # account, set params$kseaUseAbsoluteLog2FC to TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1586 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1587 # Should KSEA be performed aggregating signed log2FC or absolute?
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1588 # FALSE use raw log2FC for KSEA as for KSEAapp::KSEA.Scores
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1589 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1590 # squash un-actionable "no visible global for ..."
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1591 if (params$kseaUseAbsoluteLog2FC) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1592 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1593 # TRUE use abs(log2FC) for KSEA as Justin requested; this is a
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1594 # justifiable deviation from the KSEAapp::KSEA.Scores algorithm.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1595 new$log2_fc <- abs(new$log2_fc)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1596 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1597
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1598 monitor_filtration_on_stderr <- TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1599 if (monitor_filtration_on_stderr) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1600 # set to TRUE to monitor filtration on stderr
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1601 sink(stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1602 cat(see_variable(networkin, "\n"))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1603 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1604 ksdata_filtered <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1605 sqldf::sqldf(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1606 sprintf("%s %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1607 "select * from ksdata where not Source = 'NetworKIN'",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1608 if (networkin)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1609 sprintf("or networkin_score >= %d", networkin_cutoff)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1610 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1611 ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1612 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1613 )
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1614 if (FALSE) write.csv(x = ksdata_filtered, file = "ksdata_filtered.csv")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1615 if (monitor_filtration_on_stderr) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1616 cat(see_variable(sqldf::sqldf(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1617 "select count(*), Source from ksdata group by Source"), "\n"))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1618 cat(see_variable(sqldf::sqldf(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1619 "select count(*), Source from ksdata_filtered group by Source"), "\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1620 sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1621 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1622
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1623 ############################################################################
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1624 # Line numbers below refer to lines of:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1625 # https://github.com/casecpb/KSEAapp/blob/master/R/KSEA.Scores.R
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1626 # I would put the original line in a comment but then lint would complain...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1627 # - Indeed, I had to rename all the variables because lint didn't like names
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1628 # containing periods or capital letters.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1629 # ACE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1630 ############################################################################
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1631 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1632 # (1) Join the two data.frames on common columns SUB_GENE and SUB_MOD_RSD
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1633 # colnames of ksdata_filtered:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1634 # "KINASE" "KIN_ACC_ID" "GENE" "KIN_ORGANISM" "SUBSTRATE" "SUB_GENE_ID"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1635 # "SUB_ACC_ID" "SUB_GENE" "SUB_ORGANISM" "SUB_MOD_RSD" "SITE_GRP_ID"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1636 # "SITE_...7_AA" "networkin_score" "Source"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1637 # colnames of new:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1638 # "Protein" "SUB_GENE" "Peptide" "SUB_MOD_RSD" "p" "FC" "log2_fc"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1639 # Equivalent to:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1640 # SELECT a.*. b.Protein, b.Peptide, b.p, b.FC, b.log2_fc
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1641 # FROM ksdata_filtered a
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1642 # INNER JOIN new b
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1643 # ON a.SUB_GENE = b.SUB_GENE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1644 # AND a.SUB_MOD_RSD = b.SUB_MOD_RSD
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1645 # (KSEA.Scores.R line # 105)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1646 # "Extract KSData.filtered annotations that are only found in new"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1647 ksdata_dataset <- base::merge(ksdata_filtered, new)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1648 # colnames of ksdata_dataset:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1649 # "KINASE" "KIN_ACC_ID" "GENE" "KIN_ORGANISM" "SUBSTRATE"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1650 # "SUB_GENE_ID" "SUB_ACC_ID" "SUB_GENE" "SUB_ORGANISM" "SUB_MOD_RSD"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1651 # "SITE_GRP_ID" "SITE_...7_AA" "networkin_score" "Source" "Protein"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1652 # "Peptide" "p" "FC" "log2_fc" (uniprot_no_isoform)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1653 # Re-order dataset; prior to accounting for isoforms
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1654 # (KSEA.Scores.R line # 106)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1655 ksdata_dataset <- ksdata_dataset[order(ksdata_dataset$GENE), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1656 # Extract non-isoform accession in UniProtKB
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1657 # (KSEA.Scores.R line # 107)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1658 ksdata_dataset$uniprot_no_isoform <- sapply(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1659 ksdata_dataset$KIN_ACC_ID,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1660 function(x) unlist(strsplit(as.character(x), split = "-"))[1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1661 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1662 # "last expression collapses isoforms ... for easy processing"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1663 # Discard previous results while selecting interesting columns ...
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1664 # (KSEA.Scores.R line # 110)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1665 ksdata_dataset_abbrev <- ksdata_dataset[, c(5, 1, 2, 16:19, 14)]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1666 # Column names are now:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1667 # "GENE" "SUB_GENE" "SUB_MOD_RSD" "Peptide" "p"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1668 # "FC" "log2_fc" "Source"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1669 # Make column names human-readable
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1670 # (KSEA.Scores.R line # 111)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1671 colnames(ksdata_dataset_abbrev) <- c(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1672 "Kinase.Gene", "Substrate.Gene", "Substrate.Mod", "Peptide", "p",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1673 "FC", "log2FC", "Source"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1674 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1675 # SELECT * FROM ksdata_dataset_abbrev
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1676 # ORDER BY Kinase.Gene, Substrate.Gene, Substrate.Mod, p
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1677 # (KSEA.Scores.R line # 112)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1678 # "Extract KSData.filtered annotations that are only found in new"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1679 ksdata_dataset_abbrev <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1680 ksdata_dataset_abbrev[
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1681 order(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1682 ksdata_dataset_abbrev$Kinase.Gene,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1683 ksdata_dataset_abbrev$Substrate.Gene,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1684 ksdata_dataset_abbrev$Substrate.Mod,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1685 ksdata_dataset_abbrev$p),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1686 ]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1687 if (print_nb_messages) nbe(see_variable(ksdata_dataset_abbrev))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1688 if (FALSE) write.csv(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1689 x = ksdata_dataset_abbrev,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1690 file = "ksdata_dataset_abbrev_no_aggregation.csv",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1691 row.names = FALSE
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1692 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1693
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1694 # For some kinases, the only difference between kinase names in two databases
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1695 # is the case of the the letters; dedup to eliminate this false distinction
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1696 # The only imperfection with this approach is when the NetworKIN-only fliter
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1697 # is in force and there is a duplication between NetworKIN and HPRD (which
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1698 # outranks NetworKIN). Presently, the script does not invoke with this
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1699 # function with the NetworKIN-only filter active.
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1700 dedup_sql <- "
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1701 select
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1702 r.'Kinase.Gene', r.'Substrate.Gene', r.'Substrate.Mod',
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1703 r.Peptide, r.p, r.FC, r.log2FC, r.Source
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1704 from
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1705 ( select
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1706 rowid,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1707 rank() over
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1708 (partition by
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1709 lower(k.'Kinase.Gene'), k.p, k.FC
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1710 order by
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1711 k.Source
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1712 ) as rank,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1713 *
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1714 from
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1715 ksdata_dataset_abbrev k
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1716 ) as r
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1717 where r.rank = 1
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1718 "
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1719 ksdata_dataset_abbrev <- sqldf::sqldf(x = dedup_sql)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1720 if (FALSE) write.csv(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1721 x = ksdata_dataset_abbrev,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1722 file = "ksdata_dataset_abbrev_no_aggregation_dedup.csv",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1723 row.names = FALSE
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1724 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1725
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1726 # First aggregation step to account for multiply phosphorylated peptides
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1727 # and differing peptide sequences; the goal here is to combine results
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1728 # for all measurements of the same substrate.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1729 # SELECT `Kinase.Gene`, `Substrate.Gene`, `Substrate.Mod`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1730 # `Source`, avg(log2FC) AS log2FC
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1731 # FROM ksdata_dataset_abbrev
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1732 # GROUP BY `Kinase.Gene`, `Substrate.Gene`, `Substrate.Mod`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1733 # `Source`
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1734 # ORDER BY `Kinase.Gene`;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1735 # in two steps:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1736 # (1) compute average log_2(fold-change)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1737 # "take the mean of the log2FC amongst phosphosite duplicates"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1738 # (KSEA.Scores.R line # 115)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1739 ksdata_dataset_abbrev <- aggregate(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1740 log2FC ~ Kinase.Gene + Substrate.Gene + Substrate.Mod + Source,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1741 data = ksdata_dataset_abbrev,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1742 FUN = mean
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1743 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1744 if (print_nb_messages) nbe(see_variable(ksdata_dataset_abbrev))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1745 # (2) order by Kinase.Gene
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1746 # (KSEA.Scores.R line # 117)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1747 ksdata_dataset_abbrev <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1748 ksdata_dataset_abbrev[order(ksdata_dataset_abbrev$Kinase.Gene), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1749 # SELECT `Kinase.Gene`, count(*)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1750 # FROM ksdata_dataset_abbrev
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1751 # GROUP BY `Kinase.Gene`;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1752 # in two steps:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1753 # (1) Extract the list of Kinase.Gene names
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1754 # "@@@@@@@@@@@@@@@@@@@@"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1755 # "Do analysis for KSEA"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1756 # "@@@@@@@@@@@@@@@@@@@@"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1757 # (KSEA.Scores.R line # 124)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1758 kinase_list <- as.vector(ksdata_dataset_abbrev$Kinase.Gene)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1759 # (2) Convert to a named list of counts of kinases in ksdata_dataset_abrev,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1760 # named by Kinase.Gene
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1761 # (KSEA.Scores.R line # 125)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1762 kinase_list <- as.matrix(table(kinase_list))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1763 # Second aggregation step to account for all substrates per kinase
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1764 # CREATE TABLE mean_fc
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1765 # AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1766 # SELECT `Kinase.Gene`, avg(log2FC) AS log2FC
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1767 # FROM ksdata_dataset_abbrev
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1768 # GROUP BY `Kinase.Gene`
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1769 # (KSEA.Scores.R line # 127)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1770 if (print_nb_messages) nb(see_variable(ksdata_dataset_abbrev), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1771 mean_fc <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1772 aggregate(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1773 log2FC ~ Kinase.Gene,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1774 data = ksdata_dataset_abbrev,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1775 FUN = mean
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1776 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1777 if (print_nb_messages) nbe(see_variable(mean_fc), "\n")
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1778 if (FALSE) write.csv(x = mean_fc, file = "mean_fc.csv")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1779
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1780 # for contrast j
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1781 # for each kinase i
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1782 # extract log2 of fold-change (from `new` above)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1783 # (used in KSEA.Scores.R lines # 130 & 132)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1784 log2_fc_j_each_i <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1785 new$log2_fc
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1786
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1787 # for contrast j
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1788 # for all kinases i
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1789 # compute mean of abs(log2 of fold-change)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1790 # (used in KSEA.Scores.R lines # 130)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1791 mean_abs_log2_fc_j_all_i <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1792 mean(abs(log2_fc_j_each_i), na.rm = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1793
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1794 # for contrast j
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1795 # for all kinases i
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1796 # compute mean of log2 of fold-change
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1797 # (used in KSEA.Scores.R lines # 132)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1798 mean_log2_fc_j_all_i <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1799 mean(log2_fc_j_each_i, na.rm = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1800
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1801 # Reorder mean_fc, although I don't see why
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1802 # (KSEA.Scores.R line 128
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1803 mean_fc <- mean_fc[order(mean_fc[, 1]), ]
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1804 if (FALSE) write.csv(x = mean_fc, file = "mean_fc.csv")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1805 # mean_fc columns so far: "Kinase.Gene", "log2FC"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1806 # - Kinase.Gene
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1807 # indicates the gene name for each kinase.
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1808
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1809 # Create column 3: mS
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1810 # - mS
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1811 # represents the mean log2(fold change) of all the
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1812 # kinase's substrates.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1813 # (KSEA.Scores.R line # 129)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1814 mean_fc$m_s <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1815 mean_fc_m_s <- mean_fc[, 2]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1816
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1817 # Create column 4: Enrichment
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1818 # - Enrichment
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1819 # is the background-adjusted value of the kinase's mS.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1820 # (KSEA.Scores.R line # 130)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1821 mean_fc$enrichment <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1822 mean_fc_m_s / mean_abs_log2_fc_j_all_i
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1823
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1824 # Create column 5: m, count of substrates of kinase (count of j for i)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1825 # - m
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1826 # is the total number of detected substrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1827 # from the experimental dataset for each kinase.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1828 # (KSEA.Scores.R line # 131)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1829 mean_fc$m <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1830 mean_fc_m <- kinase_list
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1831
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1832
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1833 # Create column 6: z-score
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1834 # - z.score
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1835 # is the normalized score for each kinase, weighted by
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1836 # the number of identified substrates.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1837 # (KSEA.Scores.R line # 132)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1838 mean_fc$z_score <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1839 (mean_fc_m_s - mean_log2_fc_j_all_i) * sqrt(mean_fc_m) /
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1840 sd(log2_fc_j_each_i, na.rm = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1841
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1842 # Create column 7: p-value, deduced from z-score
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1843 # - p.value
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1844 # represents the statistical assessment for the z.score.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1845 # (KSEA.Scores.R line # 133)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1846 # "one-tailed p-value"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1847 mean_fc$p_value <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1848 pnorm(-abs(mean_fc$z_score))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1849
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1850 # zap excluded kinases; this must be done before adjusting p-value
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1851 if (TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1852 mean_fc <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1853 mean_fc[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1854 mean_fc$m >= minimum_substrate_count,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1855 ,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1856 drop = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1857 ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1858 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1859
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1860 # Create column 8: FDR, deduced by Benjamini-Hochberg adustment from p-value
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1861 # - FDR
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1862 # is the p-value adjusted for multiple hypothesis testing
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1863 # using the Benjamini & Hochberg method."
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1864 # (KSEA.Scores.R line # 134)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1865 mean_fc$fdr <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1866 p.adjust(mean_fc$p_value, method = "fdr")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1867
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1868 # It makes no sense to leave Z-scores negative when using
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1869 # absolute value of fold-change
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1870 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1871 # squash un-actionable "no visible global for ..."
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1872 if (params$kseaUseAbsoluteLog2FC) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
1873 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1874 mean_fc$z_score <- abs(mean_fc$z_score)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1875 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1876
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1877 # Remove second column (log2FC), which is duplicated as mS
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1878 # (KSEA.Scores.R line # 136)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1879 mean_fc <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1880 mean_fc[order(mean_fc$Kinase.Gene), -2]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1881 # Correct the column names which we had to hack because of the linter...
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1882 colnames(mean_fc) <- c(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1883 "Kinase.Gene", "mS", "Enrichment", "m", "z.score", "p.value", "FDR"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1884 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1885 # (KSEA.Scores.R line # 138)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1886 return(mean_fc)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1887 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1888
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1889 ksea_low_fdr_barplot_factory <- function(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1890 rslt,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1891 i_cntrst,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1892 i,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1893 a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1894 b_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1895 fold_change,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1896 caption
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1897 ) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1898 rslt_score_list_i <- rslt$score_list[[i]]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1899 if (!is.null(rslt_score_list_i)) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1900 rslt_score_list_i_nrow <- nrow(rslt_score_list_i)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1901 k <- data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1902 contrast = as.integer(i_cntrst),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1903 a_level = rep.int(a_level, rslt_score_list_i_nrow),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1904 b_level = rep.int(b_level, rslt_score_list_i_nrow),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1905 kinase_gene = rslt_score_list_i$Kinase.Gene,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1906 mean_log2_fc = rslt_score_list_i$mS,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1907 enrichment = rslt_score_list_i$Enrichment,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1908 substrate_count = rslt_score_list_i$m,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1909 z_score = rslt_score_list_i$z.score,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1910 p_value = rslt_score_list_i$p.value,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1911 fdr = rslt_score_list_i$FDR
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1912 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1913 selector <- switch(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1914 ksea_cutoff_statistic,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1915 "FDR" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1916 k$fdr
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1917 },
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1918 "p.value" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1919 k$p_value
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1920 },
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1921 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1922 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1923 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1924 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1925 ksea_cutoff_statistic
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1926 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1927 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1928 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1929 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1930 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1931 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1932
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1933 k <- k[selector < ksea_cutoff_threshold, ]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1934 nrow_k <- nrow(k)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1935
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1936 if (nrow_k > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1937 max_nchar_rowname <- max(nchar(rownames(k)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1938 my_cex_names <- 1.0 / (1 + nrow_k / 50)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1939
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1940 if (print_trace_messages) cat_margins("Initially")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1941 if (print_trace_messages) cat_variable(nrow_k, "\n\n", 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1942 if (print_trace_messages) cat_variable(my_cex_names, "\n\n", 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1943 if (print_trace_messages) cat_variable(max_nchar_rowname, "\n\n", 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1944
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1945 # fin: The figure region dimensions, (width, height), in inches.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1946 # mar: A numerical vector of the form c(bottom, left, top, right)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1947 # that gives the number of lines of margin to be specified
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1948 # on the four sides of the plot; default: c(5, 4, 4, 2) + 0.1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1949
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1950 # mar: The figure region dimensions, (width, height), in inches.
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1951 numeric_z_score <- as.numeric(k$z_score)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1952 bar_order <- order(-as.numeric(k$p_value))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1953 kinase_name <- k$kinase_gene
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1954 long_caption <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1955 sprintf(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1956 "Kinase z-score, %s, KSEA %s < %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1957 caption,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1958 ksea_cutoff_statistic,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1959 ksea_cutoff_threshold
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1960 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1961 my_cex_caption <- 65.0 / max(65.0, nchar(long_caption))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1962 # return a function that draws the plot
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1963 function() {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1964 par_fin <- par("fin") # vector of width_in_inches and height_in_inches)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1965 op <- par(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1966 bg = if (print_trace_messages) "yellow" else "white",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1967 fin = c(par_fin[1], min(par_fin[2], 2.5 + nrow_k / 6)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1968 mar = par("mar") +
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1969 c(3 / nrow_k, (1 + max_nchar_rowname * my_cex_names) / 2, 0, 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1970 # bottom, left, top, right
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1971 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1972 on.exit(par(op))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1973 if (print_trace_messages) cat_margins("Eventually")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1974
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1975 barplot(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1976 height = numeric_z_score[bar_order],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1977 border = NA,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1978 xpd = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1979 cex.names = my_cex_names,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1980 main = long_caption,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1981 cex.main = my_cex_caption,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1982 names.arg = kinase_name[bar_order],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1983 horiz = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1984 srt = 45,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1985 las = 1,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1986 cex.axis = 0.9
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1987 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1988 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1989 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1990 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1991 no_op
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1992 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1993 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1994
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1995 # note that this adds elements to the global variable `ksea_asterisk_hash`
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1996
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
1997 ksea_low_fdr_print <- function(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1998 rslt,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
1999 i_cntrst,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2000 i,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2001 a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2002 b_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2003 fold_change,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2004 caption,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2005 write_db = TRUE, # if TRUE, write to DB, else print table
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2006 anchor = c(const_table_anchor_p, const_table_anchor_t)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2007 ) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2008 rslt_score_list_i <- rslt$score_list[[i]]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2009 if (!is.null(rslt_score_list_i)) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2010 rslt_score_list_i_nrow <- nrow(rslt_score_list_i)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2011 k <- contrast_ksea_scores <- data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2012 contrast = as.integer(i_cntrst),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2013 a_level = rep.int(a_level, rslt_score_list_i_nrow),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2014 b_level = rep.int(b_level, rslt_score_list_i_nrow),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2015 kinase_gene = rslt_score_list_i$Kinase.Gene,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2016 mean_log2_fc = rslt_score_list_i$mS,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2017 enrichment = rslt_score_list_i$Enrichment,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2018 substrate_count = rslt_score_list_i$m,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2019 z_score = rslt_score_list_i$z.score,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2020 p_value = rslt_score_list_i$p.value,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2021 fdr = rslt_score_list_i$FDR
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2022 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2023
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2024 selector <- switch(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2025 ksea_cutoff_statistic,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2026 "FDR" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2027 k$fdr
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2028 },
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2029 "p.value" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2030 k$p_value
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2031 },
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2032 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2033 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2034 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2035 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2036 ksea_cutoff_statistic
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2037 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2038 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2039 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2040 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2041 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2042 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2043
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2044 k <- k[selector < ksea_cutoff_threshold, ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2045 # save kinase names to ksea_asterisk_hash
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2046 for (kinase_name in k$kinase_gene) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2047 ksea_asterisk_hash[[kinase_name]] <- 1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2048 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2049
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2050 if (write_db) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2051 db_write_table_overwrite <- (i_cntrst < 2)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2052 db_write_table_append <- !db_write_table_overwrite
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2053 RSQLite::dbWriteTable(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2054 conn = db,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2055 name = "contrast_ksea_scores",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2056 value = contrast_ksea_scores,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2057 append = db_write_table_append
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2058 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2059 ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2060 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2061 selector <- switch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2062 ksea_cutoff_statistic,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2063 "FDR" = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2064 contrast_ksea_scores$fdr
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2065 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2066 "p.value" = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2067 contrast_ksea_scores$p_value
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2068 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2069 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2070 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2071 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2072 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2073 ksea_cutoff_statistic
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2074 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2075 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2076 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2077 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2078 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2079 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2080 if (print_nb_messages) nbe(see_variable(contrast_ksea_scores))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2081 output_df <- contrast_ksea_scores[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2082 selector < ksea_cutoff_threshold,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2083 c("kinase_gene", "mean_log2_fc", "enrichment", "substrate_count",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2084 "z_score", "p_value", "fdr")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2085 ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2086 output_df$kinase_gene <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2087 gsub(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2088 "_",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2089 "\\\\_",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2090 output_df$kinase_gene
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2091 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2092 colnames(output_df) <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2093 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2094 colnames(output_df)[1],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2095 colnames(output_df)[2],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2096 "enrichment",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2097 "m_s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2098 "z_score",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2099 "p_value",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2100 "fdr"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2101 )
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2102
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2103 # nolint start
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2104 output_order <- with(output_df, order(p_value))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2105 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2106 output_df <- output_df[output_order, ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2107
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2108 output_df[, 2] <- sprintf("%0.3g", output_df[, 2])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2109 output_df$fdr <- sprintf("%0.4f", output_df$fdr)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2110 output_df$p_value <- sprintf("%0.2e", output_df$p_value)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2111 output_df$z_score <- sprintf("%0.2f", output_df$z_score)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2112 output_df$m_s <- sprintf("%d", output_df$m_s)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2113 output_df$enrichment <- sprintf("%0.3g", output_df$enrichment)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2114 colnames(output_df) <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2115 c(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2116 "Kinase or motif",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2117 "\\(\\overline{{\\lvert}\\log_2 (\\text{fold-change}){\\rvert}}\\)",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2118 "Enrichment",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2119 "Substrates",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2120 "z-score",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2121 "p-value",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2122 "FDR"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2123 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2124 selector <- switch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2125 ksea_cutoff_statistic,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2126 "FDR" = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2127 rslt$score_list[[i]]$FDR
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2128 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2129 "p.value" = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2130 rslt$score_list[[i]]$p.value
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2131 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2132 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2133 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2134 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2135 "Unexpected cutoff statistic %s rather than 'FDR' or 'p.value'",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2136 ksea_cutoff_statistic
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2137 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2138 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2139 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2140 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2141 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2142 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2143 if (sum(selector < ksea_cutoff_threshold) > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2144 if (print_nb_messages) nbe(see_variable(output_df))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2145 math_caption <- gsub("{", "\\{", caption, fixed = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2146 math_caption <- gsub("}", "\\}", math_caption, fixed = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2147 if (TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2148 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2149 x = output_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2150 # vector of tab stops, in inches
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2151 tabstops = c(1.8, 1.2, 0.8, 0.8, 0.8, 0.8, 0.8),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2152 # vector of headings, registered with tab-stops
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2153 headings = colnames(output_df),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2154 # digits to pass to format.data.frame
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2155 digits = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2156 # maximumn number of rows to print
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2157 max = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2158 # optional caption
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2159 caption = sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2160 "\\text{%s}, KSEA %s < %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2161 math_caption,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2162 ksea_cutoff_statistic,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2163 ksea_cutoff_threshold
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2164 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2165 # set underscore_whack to TRUE to escape underscores
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2166 underscore_whack = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2167 # flag for landscape mode
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2168 landscape = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2169 # flag indicating that subsubsection should be used for caption
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2170 # rather than subsection
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2171 use_subsubsection_header = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2172 # character-size indicator; for possible values, see:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2173 # https://tug.org/texinfohtml/latex2e.html#Font-sizes
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2174 charactersize = "small",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2175 # set verbatim to TRUE to debug output
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2176 verbatim = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2177 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2178 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2179 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2180 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2181 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2182 "\\break
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2183 No kinases had
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2184 \\(\\text{KSEA %s}_\\text{enrichment} < %s\\)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2185 for contrast %s\\hfill\\break\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2186 ksea_cutoff_statistic,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2187 ksea_cutoff_threshold,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2188 caption
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2189 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2190 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2191 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2192 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2193 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2194 ""
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2195 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2196 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2197
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2198 # create_breaks is a helper for ksea_heatmap
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2199 create_breaks <- function(merged_scores) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2200 if (sum(!is.na(merged_scores)) < 2)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2201 return(NULL)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2202 if (min(merged_scores, na.rm = TRUE) < -1.6) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2203 breaks_neg <- seq(-1.6, 0, length.out = 30)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2204 breaks_neg <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2205 append(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2206 seq(min(merged_scores, na.rm = TRUE), -1.6, length.out = 10),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2207 breaks_neg
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2208 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2209 breaks_neg <- sort(unique(breaks_neg))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2210 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2211 breaks_neg <- seq(-1.6, 0, length.out = 30)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2212 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2213 if (max(merged_scores, na.rm = TRUE) > 1.6) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2214 breaks_pos <- seq(0, 1.6, length.out = 30)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2215 breaks_pos <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2216 append(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2217 breaks_pos,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2218 seq(1.6, max(merged_scores, na.rm = TRUE),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2219 length.out = 10)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2220 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2221 breaks_pos <- sort(unique(breaks_pos))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2222 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2223 breaks_pos <- seq(0, 1.6, length.out = 30)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2224 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2225 breaks_all <- unique(append(breaks_neg, breaks_pos))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2226 mycol_neg <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2227 gplots::colorpanel(n = length(breaks_neg),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2228 low = "blue",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2229 high = "white")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2230 mycol_pos <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2231 gplots::colorpanel(n = length(breaks_pos) - 1,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2232 low = "white",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2233 high = "red")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2234 mycol <- unique(append(mycol_neg, mycol_pos))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2235 color_breaks <- list(breaks_all, mycol)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2236 return(color_breaks)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2237 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2238
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2239 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2240 # squash un-actionable cyclomatic_complexity warning
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2241 hm2plus <- function(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2242 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2243 x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2244 mat = matrix(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2245 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2246 c(0, 4, 0),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2247 c(0, 3, 3),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2248 c(2, 1, 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2249 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2250 nrow = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2251 ncol = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2252 byrow = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2253 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2254 denwid = 0.5,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2255 denhgt = 0.15,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2256 widths = c(0.5, 2.5, 1.5),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2257 heights = c(0.4, 0.15, 3.95),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2258 divergent = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2259 notecol = "grey50",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2260 trace = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2261 margins = c(6, 20),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2262 srtcol = 90,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2263 srtrow = 0,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2264 density_info = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2265 key_xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2266 key_par = list(),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2267 hclustfun = hclust,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2268 ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2269 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2270
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2271 if (FALSE) # this is to avoid commenting out code to pass linting...
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2272 my_hm2 <- latex_show_invocation(gplots::heatmap.2, head_patch = FALSE)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2273 else
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2274 my_hm2 <- gplots::heatmap.2
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2275
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2276 x <- as.matrix(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2277 if (sum(!is.na(x)) < 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2278 return(NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2279 color_count <- 1 + max(64, length(as.vector(x))) # 8 was not enough
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2280 break_count <- 1 + color_count
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2281 min_nonax <- min(x, na.rm = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2282 max_nonax <- max(x, na.rm = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2283 if (print_nb_messages) nb("within hm2plus", see_variable(divergent), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2284 if (divergent) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2285 zlim <- max(abs(min_nonax), abs(max_nonax))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2286 if (print_nb_messages) nb(see_variable(zlim, "\n"))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2287 breaks <- (zlim) / (break_count:1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2288 if (print_nb_messages) nb(see_variable(breaks, "\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2289 breaks <- breaks - median(breaks)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2290 zlim <- c(-zlim, zlim)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2291 if (print_nb_messages) nb(see_variable(zlim, "\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2292 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2293 zlim <- max(abs(min_nonax), abs(max_nonax))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2294 if (print_nb_messages) nb(see_variable(zlim, "\n"))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2295 breaks <- zlim / (break_count:1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2296 if (print_nb_messages) nb(see_variable(breaks, "\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2297 if (max_nonax < 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2298 breaks <- breaks - zlim
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2299 zlim <- c(-zlim, 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2300 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2301 zlim <- c(0, zlim)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2302 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2303 if (print_nb_messages) nb(see_variable(zlim, "\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2304 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2305 nonax <- x
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2306 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2307 # squash un-actionable "no visible global for ..."
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2308 if (params$heatMapNAsubstitute) nonax[is.na(x)] <- min_nonax
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2309 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2310 if (is.null(widths)) widths <- c(denwid, 4 - denwid, 1.5)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2311 if (is.null(heights)) heights <- c(0.4, denhgt, 4.0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2312 colors <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2313 if (divergent && min_nonax < 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2314 # divergent colors on both sides of zero
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2315 colorRampPalette(c("red", "white", "blue"))(color_count)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2316 } else if (divergent && min_nonax > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2317 # "divergent" colors > zero
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2318 colorRampPalette(c("white", "blue"))(color_count)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2319 } else if (divergent && max_nonax < 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2320 # "divergent" colors < zero
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2321 colorRampPalette(c("red", "white"))(color_count)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2322 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2323 # "non-divergent" colors including zero
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2324 tmp <- hcl.colors(color_count, "YlOrRd", rev = TRUE)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2325 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2326 # squash un-actionable "no visible global for ..."
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2327 tmp[1] <- params$heatMapNAgrey
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2328 # nolint end
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2329 tmp
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2330 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2331
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2332 nbe("There are ", sum(is.na(x)), " NA values")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2333
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2334 suppressWarnings(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2335 my_hm2(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2336 x = x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2337 col = colors,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2338 density.info = density_info,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2339 srtCol = srtcol,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2340 srtRow = srtrow,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2341 margins = margins,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2342 lwid = widths,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2343 lhei = heights,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2344 key.title = NA,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2345 key.xlab = key_xlab,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2346 key.par = key_par,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2347 lmat = mat,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2348 notecol = notecol,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2349 trace = trace,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2350 bg = "yellow",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2351 hclustfun = hclustfun,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2352 oldstyle = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2353 ... # varargs
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2354 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2355 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2356 # implicitly returning value returned by heatmap.2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2357 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2358
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2359 # draw_kseaapp_summary_heatmap is a helper function for ksea_heatmap
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2360 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2361 # squash un-actionable cyclomatic_complexity warning
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2362 draw_kseaapp_summary_heatmap <- function(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2363 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2364 x, # matrix with row/col names already formatted
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2365 sample_cluster, # a binary input of TRUE or FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2366 # indicating whether or not to perform
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2367 # hierarchical clustering of the sample columns
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2368 merged_asterisk, # matrix having dimensions of x, values "*" or ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2369 color_breaks, # breaks for color gradation, from create_breaks
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2370 # passed to `breaks` argument of `image`
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2371 margins = c(8, 15), # two integers setting the bottom and right margins
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2372 # to accommodate row and column labels
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2373 master_cex = 0.7, # basis for text sizes
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2374 ...
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2375 ) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2376 merged_scores <- x
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2377 if (!is.matrix(x)) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2378 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2379 paste0(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2380 "No plot because \\texttt{typeof(x)} is '",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2381 typeof(x),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2382 "' rather than 'matrix'.\n\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2383 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2384 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2385 cat_variable(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2386 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2387 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2388 if (print_trace_messages) cat(sprintf("master_cex = %03f\n\n", master_cex))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2389 nrow_x <- nrow(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2390 ncol_x <- ncol(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2391 #if (nrow_x < 2) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2392 if (nrow_x < 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2393 cat("No plot because matrix has no rows.\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2394 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2395 } else if (nrow_x < 2) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2396 cat("No plot because matrix has one row. Matrix looks like this:\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2397 cat("\n\\begin{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2398 print(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2399 cat("\n\\end{verbatim}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2400 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2401 } else if (ncol_x < 2) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2402 cat("No plot because matrix x has ", ncol_x, " columns.\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2403 cat_variable(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2404 return(FALSE)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2405 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2406 max_nchar_rowname <- max(nchar(rownames(x)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2407 max_nchar_colname <- max(nchar(colnames(x)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2408
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2409 my_row_cex_scale <- master_cex * 150 / nrow_x
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2410 # row cex shrink hack begin
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2411 my_row_cex_scale <- master_cex * 150 / max(nrow_x, ncol_x)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2412 # row cex shrink hack end
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2413
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2414 my_col_cex_scale <- 3.0
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2415 # col cex shrink hack begin
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2416 if (ncol_x > 40)
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2417 my_col_cex_scale <- 3.0 * 40 / ncol_x
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2418 # col cex shrink hack end
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2419
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2420 my_asterisk_scale <- 0.4 * my_row_cex_scale
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2421 my_row_warp <- 1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2422 my_note_warp <- 2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2423 my_row_warp <- 1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2424 my_row_cex_asterisk <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2425 master_cex * my_row_warp * my_asterisk_scale
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2426
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2427
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2428 my_col_cex <- my_col_cex_scale * master_cex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2429 my_row_cex <- min(3.5 * my_row_cex_asterisk, my_col_cex)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2430 my_key_cex <- 1.286
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2431 my_hm2_cex <- 1 * master_cex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2432 my_offset <- (4.8 / (9 + nrow_x / 10)) - 0.4
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2433 if (print_trace_messages) cat(sprintf("nrow_x = %03f\n\n", nrow_x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2434 if (print_trace_messages) cat(sprintf("my_offset = %03f\n\n", my_offset))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2435 my_offset <- 0.05
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2436 if (print_trace_messages) cat(sprintf("my_offset = %03f\n\n", my_offset))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2437 my_scale <- 3.0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2438 if (ncol_x < 10 && nrow_x < 10)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2439 my_scale <- my_scale * 10 / (10 - nrow_x) * 10 / (10 - ncol_x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2440
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2441 my_heights <- c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2442 0.15,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2443 3.85 - my_offset,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2444 0.5 + my_offset
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2445 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2446 my_margins <- c(1, 1) +
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2447 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2448 margins[1] * 0.08 * max_nchar_colname * my_col_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2449 margins[2] * 0.04 * max_nchar_rowname * my_row_cex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2450 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2451
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2452 if (print_trace_messages) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2453 cat_variable(my_heights, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2454 cat_variable(my_margins, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2455 cat_variable(my_row_cex_scale, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2456 cat_variable(my_col_cex_scale, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2457 cat_variable(my_row_cex_asterisk, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2458 cat_variable(my_row_cex, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2459 cat_variable(my_col_cex, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2460 cat_variable(my_row_cex, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2461 cat_variable(my_col_cex, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2462 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2463
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2464 hm2plus(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2465 x = merged_scores,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2466 Colv = sample_cluster,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2467 cellnote = merged_asterisk,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2468 cex = my_hm2_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2469 cexCol = my_col_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2470 cexRow = my_row_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2471 denhgt = 0.15,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2472 density_info = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2473 denwid = 0.5,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2474 divergent = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2475 key_par = list(cex = my_key_cex),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2476 key_xlab = "Z-score",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2477 margins = my_margins,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2478 notecex = my_scale * min(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2479 1.5,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2480 my_row_cex_asterisk * my_note_warp,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2481 my_col_cex * my_note_warp
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2482 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2483 notecol = "white",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2484 scale = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2485 srtcol = 90,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2486 srtrow = 0,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2487 trace = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2488 mat = matrix(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2489 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2490 c(0, 3, 3),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2491 c(2, 1, 1),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2492 c(0, 4, 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2493 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2494 nrow = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2495 ncol = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2496 byrow = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2497 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2498 widths = c(0.5, 3.1, 0.9),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2499 heights = my_heights,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2500 ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2501 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2502 return(TRUE)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2503 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2504
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2505 # function drawing heatmap of contrast fold-change for each kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2506 # adapted from KSEAapp::KSEA.Heatmap
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2507 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2508 # squash un-actionable cyclomatic_complexity warning
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2509 ksea_heatmap <- function(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2510 # nolint end
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2511 # the data frame outputs from the KSEA.Scores() function, in list format
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2512 score_list,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2513 # a character vector of all the sample names for heatmap annotation:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2514 # - the names must be in the same order as the data in score_list
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2515 # - please avoid long names, as they may get cropped in the final image
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2516 sample_labels,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2517 # character string of either "p.value" or "FDR" indicating the data column
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2518 # to use for marking statistically significant scores
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2519 stats,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2520 # a numeric value between 0 and infinity indicating the min. number of
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2521 # substrates a kinase must have to be included in the heatmap
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2522 m_cutoff,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2523 # a numeric value between 0 and 1 indicating the p-value/FDR cutoff
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2524 # for indicating significant kinases in the heatmap
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2525 p_cutoff = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2526 cat("argument 'p_cutoff' is required for function 'ksea_heatmap'")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2527 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2528 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2529 },
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2530 # a binary input of TRUE or FALSE, indicating whether or not to perform
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2531 # hierarchical clustering of the sample columns
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2532 sample_cluster,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2533 # a binary input of TRUE or FALSE, indicating whether or not to export
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2534 # the heatmap as a .png image into the working directory
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2535 export = FALSE,
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2536 # bottom and right margins; adjust as needed if contrast names are too long
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2537 margins = c(6, 6),
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2538 # print which kinases?
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2539 # - Mandatory argument, must be one of const_ksea_.*_kinases
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2540 which_kinases,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2541 # additional arguments to gplots::heatmap.2, such as:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2542 # - main: main title of plot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2543 # - xlab: x-axis label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2544 # - ylab: y-axis label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2545 ...
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2546 ) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2547 filter_m <- function(dataset, m_cutoff) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2548 filtered <- dataset[(dataset$m >= m_cutoff), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2549 return(filtered)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2550 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2551 score_list_m <- lapply(score_list, function(...) filter_m(..., m_cutoff))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2552 for (i in seq_len(length(score_list_m))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2553 names <- colnames(score_list_m[[i]])[c(2:7)]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2554 colnames(score_list_m[[i]])[c(2:7)] <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2555 paste(names, i, sep = ".")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2556 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2557 master <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2558 Reduce(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2559 f = function(...) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2560 base::merge(..., by = "Kinase.Gene", all = TRUE)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2561 },
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2562 x = score_list_m
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2563 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2564
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2565 row.names(master) <- master$Kinase.Gene
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2566 columns <- as.character(colnames(master))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2567 merged_scores <- as.matrix(master[, grep("z.score", columns), drop = FALSE])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2568 colnames(merged_scores) <- sample_labels
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2569 merged_stats <- as.matrix(master[, grep(stats, columns)])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2570 asterisk <- function(mtrx, p_cutoff) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2571 new <- data.frame()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2572 for (i in seq_len(nrow(mtrx))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2573 for (j in seq_len(ncol(mtrx))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2574 my_value <- mtrx[i, j]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2575 if (!is.na(my_value) && my_value < p_cutoff) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2576 new[i, j] <- "*"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2577 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2578 new[i, j] <- ""
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2579 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2580 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2581 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2582 return(new)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2583 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2584 merged_asterisk <- as.matrix(asterisk(merged_stats, p_cutoff))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2585
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2586 asterisk_rows <- rowSums(merged_asterisk == "*") > 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2587 all_rows <- rownames(merged_stats)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2588 names(asterisk_rows) <- all_rows
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2589 non_asterisk_rows <- names(asterisk_rows[asterisk_rows == FALSE])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2590 asterisk_rows <- names(asterisk_rows[asterisk_rows == TRUE])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2591
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2592 row_list <- list()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2593 row_list[[const_ksea_astrsk_kinases]] <- asterisk_rows
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2594 row_list[[const_ksea_all_kinases]] <- all_rows
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2595 row_list[[const_ksea_nonastrsk_kinases]] <- non_asterisk_rows
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2596
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2597 i <- which_kinases
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2598 my_row_names <- row_list[[i]]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2599 scrs <- merged_scores[my_row_names, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2600 stts <- merged_stats[my_row_names, , drop = FALSE]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2601 merged_asterisk <- as.matrix(asterisk(stts, p_cutoff))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2602
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2603 color_breaks <- create_breaks(scrs)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2604 if (is.null(color_breaks)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2605 cat("No plot because matrix has too few rows.\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2606 return(NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2607 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2608 plot_height <- nrow(scrs) ^ 0.55
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2609 plot_width <- ncol(scrs) ^ 0.7
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2610 if (export == "TRUE") {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2611 png(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2612 "KSEA.Merged.Heatmap.png",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2613 width = plot_width * 300,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2614 height = 2 * plot_height * 300,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2615 res = 300,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2616 pointsize = 14
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2617 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2618 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2619 did_draw <- draw_kseaapp_summary_heatmap(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2620 x = scrs,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2621 sample_cluster = sample_cluster,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2622 merged_asterisk = merged_asterisk,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2623 color_breaks = color_breaks,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2624 margins = margins
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2625 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2626 if (export == "TRUE") {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2627 dev.off()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2628 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2629 if (!did_draw)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2630 return(NULL)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2631 return(my_row_names)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2632 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2633
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2634 # helpers for heatmaps of phosphopeptide intensities
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2635
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2636 # factory producing function to truncate string after n characters
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2637 trunc_n <- function(n) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2638 function(x) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2639 sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2640 X = x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2641 FUN = function(s) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2642 if (is.na(s))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2643 return("NA")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2644 cond <- try_catch_w_e(nchar(s) > n)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2645 if (!is.logical(cond$value)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2646 return(cond$value$message)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2647 } else if (cond$value) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2648 paste0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2649 strtrim(s, n),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2650 "..."
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2651 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2652 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2653 s
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2654 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2655 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2656 USE.NAMES = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2657 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2658 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2659 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2660 trunc_long_ppep <- function(x) trunc_n(40)(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2661 trunc_ppep <- function(x) trunc_n(g_ppep_trunc_n)(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2662 trunc_subgene <- function(x) trunc_n(g_subgene_trunc_n)(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2663 trunc_enriched_substrate <- function(x) trunc_n(g_sbstr_trunc_n)(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2664
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2665 # factory producing a function that returns a covariance
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2666 # matrix's rows (and columns) having variance > v_min
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2667 keep_cov_w_var_gtr_min <- function(v_min) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2668 function(x) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2669 if (!is.matrix(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2670 return(NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2671 keepers <- sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2672 X = seq_len(nrow(x)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2673 FUN = function(i) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2674 if (x[i, i] < v_min)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2675 NA
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2676 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2677 x[i, i]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2678 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2679 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2680 names(keepers) <- rownames(x)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2681 keepers <- keepers[!is.na(keepers)]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2682 keepers <- names(keepers)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2683 if (length(keepers) == 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2684 return(NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2685 x[keepers, keepers]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2686 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2687 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2688 # function that returns a matrix's rows having variance > 1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2689 keep_cov_w_var_gtr_1 <- keep_cov_w_var_gtr_min(1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2690
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2691 # factory producing a function that returns
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2692 # - either a matrix's rows (rows = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2693 # - or a matrix's columns (rows = FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2694 # having variance > v_min
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2695 keep_var_gtr_min <- function(v_min) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2696 function(x, rows = TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2697 nrowcol <- if (rows) nrow else ncol
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2698 if (!is.matrix(x))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2699 return(NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2700 keepers <- sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2701 X = seq_len(nrowcol(x)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2702 FUN = function(i) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2703 row_var <- var(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2704 if (rows) x[i, ] else x[, i],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2705 na.rm = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2706 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2707 if (is.na(row_var) || row_var <= v_min) NA else i
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2708 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2709 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2710 keepers <- keepers[!is.na(keepers)]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2711 if (rows) x[keepers, ] else x[, keepers]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2712 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2713 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2714
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2715 keep_var_gtr_0 <- keep_var_gtr_min(0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2716
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2717 # function drawing heatmap of phosphopeptide intensities
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2718 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2719 # squash un-actionable cyclomatic_complexity warning
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2720 ppep_heatmap <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2721 # nolint end
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2722 function(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2723 m, # matrix with rownames already formatted
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2724 cutoff, # cutoff used by hm_heading_function
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2725 hm_heading_function, # construct $ cat heading from m and cutoff
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2726 hm_main_title, # main title for plot (drawn below heading)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2727 suppress_row_dendrogram = TRUE, # set to false to show dendrogram
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2728 max_peptide_count = # experimental:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2729 g_intensity_hm_rows, # values of 50 and 75 worked well
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2730 master_cex = 1.0, # basis for text sizes
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2731 margins = NULL, # optional margins (bottom, right)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2732 cellnote = NULL, # optional matrix of character; dim = dim(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2733 adj = 0.5, # adjust text: 0 left, 0.5 middle, 1 right
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2734 row_scaling = # should row-scaling be applied if possible?
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2735 g_default_heatmap_row_scaling,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2736 ... # passthru to hm2plus or heatmap.2
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2737 ) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2738 peptide_count <- 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2739 # emit the heading for the heatmap
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2740 if (hm_heading_function(m, cutoff)) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2741 nrow_m <- nrow(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2742 peptide_count <- min(max_peptide_count, nrow_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2743 if (nrow_m > 1) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2744 m_margin <- m[peptide_count:1, ]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2745 # Margin was heuristically derived to accommodate the widest label
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2746 row_mchar_max <- max(nchar(rownames(m_margin)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2747 col_mchar_max <- max(nchar(colnames(m_margin)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2748 row_margin <- master_cex * row_mchar_max * 2.6
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2749 col_margin <- master_cex * col_mchar_max * 2.6
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2750 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2751 sprintf("row_margin = %0.3f; ", row_margin))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2752 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2753 sprintf("col_margin = %0.3f; ", col_margin))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2754 hm_call <- NULL
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2755 tryCatch(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2756 {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2757 # set non-argument parameters for hm_call inner function
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2758 my_row_cex <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2759 master_cex * 200000 / (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2760 (max(nchar(rownames(m_margin)))^2) * g_intensity_hm_rows
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2761 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2762 m_hm <- m[peptide_count:1, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2763 if (is.null(cellnote)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2764 cellnote <- matrix("", nrow = nrow(m_hm), ncol = ncol(m_hm))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2765 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2766 # squash un-actionable "no visible global for ..."
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2767 cellnote[is.na(m_hm)] <- params$heatMapNAcellNote
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2768 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2769 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2770 cellnote <- cellnote[peptide_count:1, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2771 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2772 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2773 # squash un-actionable "no visible global for ..."
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2774 if (params$heatMapNAsubstitute) m_hm[is.na(m_hm)] <- 0
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2775 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2776 nrow_m_hm <- nrow(m_hm)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2777 ncol_m_hm <- ncol(m_hm)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2778 if (nrow_m_hm < 1 || ncol_m_hm < 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2779 return(peptide_count) # return zero as initialized above
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2780
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2781
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2782 my_row_cex <- master_cex * (100 / (2 + row_mchar_max))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2783 my_col_cex <- master_cex * 6 * row_margin / col_margin
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2784 my_col_adj <- min(my_col_cex, my_row_cex) / my_col_cex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2785 my_col_cex <- min(my_col_cex, my_row_cex)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2786 col_margin <- sqrt(my_col_adj) * col_margin
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2787 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2788 sprintf("my_row_cex = %0.3f; ", my_row_cex))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2789 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2790 sprintf("my_col_cex = %0.3f; ", my_col_cex))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2791 if (is.null(margins)) my_margins <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2792 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2793 (my_col_cex + col_margin), # col
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2794 (my_row_cex + row_margin) / my_row_cex # row
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2795 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2796 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2797 my_margins <- margins
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2798
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2799 if (print_trace_messages) cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2800 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2801 "my_margins = c(%s)\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2802 paste(my_margins, collapse = ", ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2803 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2804 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2805 my_hm2_cex <- 2 * master_cex
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2806 my_key_cex <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2807 0.9 -
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2808 0.1 * (g_intensity_hm_rows + nrow_m_hm) / g_intensity_hm_rows
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2809 my_key_warp <- 1.5 * 22.75 / row_margin
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2810 my_key_cex <- min(1.10, my_key_warp * my_key_cex)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2811 my_hgt_scale <- 3.70 - 0.4 * (max(1, 0.9 * my_row_cex) - 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2812 my_hgt_scale <- 3.75 # 3.615
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2813 my_hgt_scale <- 3.60 # 3.615
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2814 if (print_trace_messages)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2815 cat_variable(my_hgt_scale, "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2816 my_warp <- max(0.1, 1.4 * (7.5 + nrow_m) / g_intensity_hm_rows)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2817 if (print_trace_messages)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2818 cat_variable(my_warp, "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2819 # added 0.9 heuristically...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2820 my_plot_height <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2821 (0.566 + 0.354 * (nrow_m / g_intensity_hm_rows)) *
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2822 min(my_hgt_scale, my_hgt_scale * my_warp)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2823 my_plot_height <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2824 min(3.65, my_plot_height * g_intensity_hm_rows / 50)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2825 my_heights <- c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2826 0.3, # title and top dendrogram
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2827 my_plot_height, # plot and bottom margin
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2828 4.15 - my_hgt_scale, # legend
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2829 0.05 + my_hgt_scale - my_plot_height # whitespace below legend
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2830 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2831 my_note_cex <- min(0.8, my_row_cex, my_col_cex)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2832 if (print_trace_messages) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2833 cat_variable(my_plot_height, "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2834 cat_variable(4.19 - my_hgt_scale, "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2835 cat_variable(nrow_m_hm, "; ", 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2836 cat_variable(ncol_m_hm, "; ", 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2837 cat_variable(my_row_cex, "; ", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2838 cat_variable(my_col_cex, "; ", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2839 cat_variable(my_note_cex, "; ", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2840 cat_variable(my_key_cex, "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2841 cat_variable(my_hgt_scale, "; ", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2842 cat_variable(my_plot_height, "; ", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2843 cat_variable(my_warp, "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2844 cat_variable(my_heights, "; ", 2)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2845 cat_variable(sum(my_heights), "\n\n", 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2846 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2847
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2848 # define hm_call inner function
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2849 hm_call <- function(x, scaling, title) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2850 my_cex_main <- min(5.0, 220 / nchar(title))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2851 op <- par(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2852 cex.main = my_cex_main * master_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2853 adj = adj
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2854 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2855 if (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2856 !is.null(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2857 hm2plus(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2858 x,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2859 Colv = NA,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2860 Rowv = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2861 cexRow = my_row_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2862 cexCol = my_col_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2863 dendrogram = "row",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2864 las = 1,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2865 main = title,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2866 key_xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2867 cex = my_hm2_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2868 key_par = list(cex = my_key_cex),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2869 margins = my_margins,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2870 widths = c(0.4, 2.6, 1.5),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2871 heights = my_heights,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2872 mat = matrix(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2873 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2874 c(0, 3, 3),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2875 c(2, 1, 1),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2876 c(0, 4, 0),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2877 c(0, 0, 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2878 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2879 nrow = 4,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2880 ncol = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2881 byrow = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2882 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2883 na.rm = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2884 scale = scaling,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2885 srtcol = 90,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2886 srtrow = 0,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2887 xlab = "",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2888 cellnote = cellnote,
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2889 # ref for na.color:
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2890 # https://cran.r-project.org/web/packages/gplots/gplots.pdf
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2891 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2892 # squash un-actionable "no visible global for ..."
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2893 na.color = params$heatMapNAcellColor,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2894 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2895 notecex = my_note_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2896 ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2897 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2898 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2899 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2900 if (print_trace_messages) cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2901 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2902 "my_heights = c(%s); sum = %0.3f\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2903 paste(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2904 sprintf("%0.3f", my_heights),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2905 collapse = ", "
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2906 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2907 sum(my_heights)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2908 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2909 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2910 if (print_trace_messages) cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2911 sprintf("my_key_cex = %0.3f\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2912 my_key_cex)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2913 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2914 if (print_trace_messages) cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2915 sprintf("my_key_cex/my_heights[3] = %0.3f\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2916 my_key_cex / my_heights[3])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2917 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2918 if (print_trace_messages) cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2919 sprintf("my_heights[2]/my_heights[3] = %0.3f\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2920 my_heights[2] / my_heights[3])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2921 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2922 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2923 par(op)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2924 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2925
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2926 # invoke hm_call inner function
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2927 if (row_scaling != "row" || sum(rowSums(!is.na(m_hm)) < 2))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2928 hm_call(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2929 m_hm,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2930 "none",
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2931 "log(intensities), unimputed, and unnormalized"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2932 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2933 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2934 hm_call(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2935 m_hm,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2936 "row",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2937 "log(intensities), row-scaled, unimputed, and unnormalized"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2938 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2939 },
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2940 error = function(e) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2941 if (!is.null(hm_call)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2942 m_hm[is.na(m_hm)] <- 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2943 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2944 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2945 if (nrow(m_hm) > 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2946 hm_call(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2947 m_hm,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2948 "none",
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
2949 "log(intensities), zero-imputed, unnormalized"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2950 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2951 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2952 cat("\nThere are too few peptides to produce a heatmap.\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2953 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2954 error = function(r) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2955 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2956 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2957 "\n%s %s Internal message: %s\n\\newline\n\n",
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2958 "Failure drawing heatmap, possibly because of ",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2959 "too many missing values.\n\\newline\n\n",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2960 r$message
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2961 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2962 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2963 cat_margins()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2964 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2965 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2966 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2967 cat(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2968 "\nFailure drawing heatmap, ",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2969 "possibly because of too many missing values.\n"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2970 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2971 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2972 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2973 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2974 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2975 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2976 # return value:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2977 peptide_count
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
2978 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2979
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2980 # function drawing heatmap of correlations if they exist, else covariances
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2981 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2982 # squash un-actionable cyclomatic_complexity warning
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2983 # squash un-actionable "no visible global for ..."
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2984 cov_heatmap <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2985 function(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2986 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2987 m, # matrix with rownames already formatted
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2988 kinase_name,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2989 top_substrates = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2990 ... # passthru to hm2plus or heatmap.2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2991 ) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2992 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
2993 see_variable(m), " [", nrow(m), "x", ncol(m), "\n")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2994 colnames_m <- colnames(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2995 is_na_m <- is.na(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2996 tmp <- m
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2997 tmp[is_na_m] <- 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2998
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
2999 tmp <- m[, 0 < colSums(x = tmp)] # by default, na.rm is FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3000
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3001 colnames_tmp <- colnames(tmp)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3002
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3003 my_low_p_seq <- seq(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3004 from = min(g_intensity_hm_rows, nrow(m)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3005 to = 1,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3006 by = -1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3007 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3008
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3009 if (g_correlate_substrates) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3010 # zap samples having zero or near-zero variance
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3011 tmp[is.na(tmp)] <- 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3012 nzv <- caret::nearZeroVar(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3013 tmp, # matrix of values, samples x variables
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3014 freqCut = 1.01, # min(freq most prevalent value /
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3015 # freq second most prevalent)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3016 uniqueCut = 99 # max(number of unique values /
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3017 # total number of samples)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3018 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3019 tmp <- if (length(nzv) > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3020 m[, -nzv, drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3021 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3022 m
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3023 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3024 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3025 tmp <- m[my_low_p_seq, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3026 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3027
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3028
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3029 t_m <- t(tmp)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3030 t_m[is.na(t_m)] <- 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3031
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3032 my_corcov <- cov(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3033 did_filter_rows <- did_filter_cols <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3034 if (g_correlate_substrates && !is_positive_definite(my_corcov)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3035 my_correlate_substrates <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3036 t_m <- t(m[my_low_p_seq, , drop = FALSE])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3037 t_m[is.na(t_m)] <- 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3038 unfiltered_row_count <- ncol(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3039 unfiltered_col_count <- nrow(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3040
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3041 # zap empty samples
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3042 t_m <- t_m[0 < rowSums(x = t_m), ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3043 # zap substrates present in fewer than two samples
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3044 foo <- t_m > 0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3045 foo <- colSums(x = foo) > 1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3046 t_m <- t_m[, foo]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3047
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3048 did_filter_rows <- unfiltered_row_count > ncol(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3049 did_filter_cols <- unfiltered_col_count > nrow(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3050
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3051 colnames_tmp <- rownames(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3052 my_corcov <- cov(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3053 if (g_filter_cov_var_gt_1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3054 my_corcov <- keep_cov_w_var_gtr_1(my_corcov)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3055 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3056 } else if (g_correlate_substrates) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3057 my_corcov <- cov2cor(my_corcov)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3058 my_correlate_substrates <- TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3059 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3060 my_correlate_substrates <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3061 if (g_filter_cov_var_gt_1) my_corcov <- keep_cov_w_var_gtr_1(my_corcov)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3062 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3063
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3064 omitted_samples <- colnames_m[colnames_m %notin% colnames_tmp]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3065 suffix <- if (length(omitted_samples) > 1) "s" else ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3066
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3067 f_omissions <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3068 function(is_corr) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3069 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3070 sprintf(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3071 "Below is the %s plot for %s sites",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3072 if (is_corr) "correlation" else "covariance",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3073 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3074 if (top_substrates)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3075 "%0.0f \"highest-quality\""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3076 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3077 "%0.0f",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3078 ncol(t_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3079 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3080 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3081 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3082 if (did_filter_cols) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3083 cat(sprintf(", omitting sample%s ", suffix))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3084 latex_collapsed_vector(", ", omitted_samples)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3085 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3086 cat(".\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3087 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3088
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3089 if (is.null(my_corcov) || sum(!is.na(t_m)) < 2) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3090 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3091 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3092 "\\newline\n%s %s plot.\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3093 "Insufficient covariance to produce",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3094 if (my_correlate_substrates)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3095 "correlation"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3096 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3097 "covariance"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3098 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3099 "\\newpage\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3100 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3101 return(NULL)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3102 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3103
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3104 cat("\\leavevmode\n", "\\newpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3105 f_omissions(my_correlate_substrates)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3106
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3107 master_cex <- 0.4
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3108 max_nchar <- max(nchar(rownames(t_m)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3109 my_limit <- g_intensity_hm_rows
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3110 diminution <- sqrt(my_limit / (my_limit + ncol(t_m)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3111 my_row_cex <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3112 my_col_cex <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3113 min(1.75, master_cex * 9 * diminution ^ 1.5)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3114 my_margin <- 3 + my_row_cex * 64 / (8 + max_nchar)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3115 my_key_cex <- 1.4
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3116 my_hm2_cex <- 1.0 * master_cex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3117 my_hgt_scale <- 3.50 - 0.26 * (max(0.4, my_key_cex) - 0.4)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3118 my_hgt_scale <- 2.7
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3119
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3120 my_legend_height <- 4.0 - my_hgt_scale
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3121 my_legend_height <- 0.5 * my_key_cex
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3122 my_warp <- 0.65 * (my_limit + ncol(t_m)) / my_limit
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3123 my_warp <- 0.8
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3124 my_legend_height <- 0.77
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3125 my_legend_height <- 0.67
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3126 my_plot_height <- my_hgt_scale + (1 - my_warp) * my_legend_height
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3127 my_legend_height <- my_warp * my_legend_height
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3128
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3129 parjust <- par(adj = 0.5)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3130 on.exit(par(parjust))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3131 my_corcov <- my_corcov[order(rownames(my_corcov)), ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3132 my_main <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3133 sprintf("%s among %s sites %s",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3134 if (my_correlate_substrates) "Correlation"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3135 else "Covariance",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3136 kinase_name,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3137 if (!my_correlate_substrates &&
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3138 g_filter_cov_var_gt_1 &&
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3139 did_filter_rows
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3140 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3141 "having variance > 1"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3142 else ""
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3143 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3144 my_main_nchar <- nchar(my_main)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3145 my_heights <- c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3146 0.3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3147 my_plot_height,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3148 my_legend_height # was 4.0 - my_hgt_scale # was 4.19
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3149 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3150 if (print_trace_messages) cat(sprintf("max_nchar = %0.3f; ", max_nchar))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3151 if (print_trace_messages) cat(sprintf("my_margin = %0.3f; ", my_margin))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3152 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3153 sprintf("my_plot_height = %0.3f\n\n", my_plot_height))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3154 if (print_trace_messages) cat(sprintf("master_cex = %0.3f; ", master_cex))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3155 if (print_trace_messages) cat(sprintf("my_row_cex = %0.3f; ", my_row_cex))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3156 if (print_trace_messages) cat(sprintf("my_col_cex = %0.3f; ", my_col_cex))
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3157 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3158 sprintf("my_key_cex = %0.3f\n\n", my_key_cex))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3159 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3160 sprintf("my_hgt_scale = %0.3f\n\n", my_hgt_scale))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3161 if (print_trace_messages) cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3162 sprintf("legend height = %0.3f\n\n", my_legend_height))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3163 if (print_trace_messages) cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3164 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3165 "my_heights = c(%s); sum = %0.3f\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3166 paste(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3167 sprintf("%0.3f", my_heights),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3168 collapse = ", "
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3169 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3170 sum(my_heights)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3171 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3172 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3173 op <- par(cex.main = (30 + my_main_nchar) / my_main_nchar)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3174 on.exit(par(op))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3175 hm2plus(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3176 x = my_corcov,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3177 cex = my_hm2_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3178 cexCol = my_col_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3179 cexRow = my_row_cex,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3180 density_info = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3181 denhgt = 0.15,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3182 denwid = 0.5,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3183 divergent = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3184 key_par = list(cex = my_key_cex),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3185 key_xlab = if (my_correlate_substrates) "Correlation"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3186 else "Covariance",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3187 main = my_main,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3188 mat = matrix(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3189 c(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3190 c(0, 3, 3),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3191 c(2, 1, 1),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3192 c(0, 4, 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3193 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3194 nrow = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3195 ncol = 3,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3196 byrow = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3197 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3198 heights = my_heights,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3199 margins = c(my_margin, my_margin),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3200 widths = c(0.5, 3.1, 0.9),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3201 scale = "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3202 symkey = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3203 symbreaks = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3204 symm = FALSE #TODO evaluate TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3205 # ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3206 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3207 } # end cov_heatmap
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3208
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3209 ### FILE IMPORT
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3210
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3211 # function reading bzipped file to data.frame
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3212 bzip2df <- function(d, f, ctor = bzfile) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3213 # read.delim file (by default, compressed by bzip2)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3214 if (file.exists(f)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3215 conn <- NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3216 pf <- parent.frame()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3217 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3218 assign(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3219 as.character(substitute(d)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3220 read.delim(conn <- bzfile(f, open = "r")),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3221 pf
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3222 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3223 finally = if (!is.null(conn)) close(conn)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3224 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3225 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3226 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3227
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3228 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3229
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3230 # Purpose
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3231
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3232 The purpose of this analysis is to perform for phosphopeptides:
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3233
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3234 - imputation of missing values,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3235 - quantile normalization,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3236 - ANOVA (using the R stats::`r params$oneWayManyCategories` function),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3237 - assignment of an FDR-adjusted $p$-value and a "quality score" to each phosphopeptide, and
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3238 - KSEA (Kinase-Substrate Enrichment Analysis) using code adapted from the CRAN `KSEAapp` package to search for kinase substrates from the following databases:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3239 - PhosphoSitesPlus [https://www.phosphosite.org](https://www.phosphosite.org)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3240 - The Human Proteome Database [http://hprd.org](http://hprd.org)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3241 - NetworKIN [http://networkin.science/](http://networkin.science/)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3242 - Phosida [http://pegasus.biochem.mpg.de/phosida/help/motifs.aspx](http://pegasus.biochem.mpg.de/phosida/help/motifs.aspx)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3243
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3244 ```{r include = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3245
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3246 if (params$kseaUseAbsoluteLog2FC) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3247 sfc <- "|s|"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3248 pfc <- "|p|"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3249 pfc_txt <- "$\\text{absolute value}({\\log_2 (\\text{fold-change})})$"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3250 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3251 sfc <- "s"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3252 pfc <- "p"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3253 pfc_txt <- "${\\log_2 (\\text{fold-change}})$"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3254 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3255
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3256 ksea_heatmap_titles <- list()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3257 ksea_heatmap_titles[[const_ksea_astrsk_kinases]] <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3258 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3259 "Summary for all kinases enriched in one or more contrasts at %s < %s",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3260 ksea_cutoff_statistic,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3261 ksea_cutoff_threshold
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3262 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3263 ksea_heatmap_titles[[const_ksea_all_kinases]] <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3264 "Summary figure for all contrasts and all kinases"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3265 ksea_heatmap_titles[[const_ksea_nonastrsk_kinases]] <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3266 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3267 "Summary for all kinases not enriched at %s < %s in any contrast",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3268 ksea_cutoff_statistic,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3269 ksea_cutoff_threshold
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3270 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3271 # hash to hold names of significantly enriched kinases
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3272 ksea_asterisk_hash <- new_env()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3273
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3274 # PROCESS (mostly read) PARAMETERS
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3275
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3276 # False discovery rate adjustment for ANOVA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3277 # Since pY abundance is low, set to 0.10 and 0.20 in addition to 0.05
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3278 val_fdr <- read.table(file = alpha_file, sep = "\t", header = FALSE, quote = "")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3279
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3280 if (
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3281 ncol(val_fdr) != 1 ||
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3282 sum(!is.numeric(val_fdr[, 1])) ||
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3283 sum(val_fdr[, 1] < 0) ||
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3284 sum(val_fdr[, 1] > 1)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3285 ) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3286 cat("alphaFile should be one column of numbers within the range [0.0,1.0]")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3287 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3288 knitr::knit_exit()
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3289 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3290 val_fdr <- val_fdr[, 1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3291
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3292 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3293
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3294 ```{r echo = FALSE, results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3295
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3296
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3297 result <- file.copy(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3298 from = preproc_db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3299 to = ksea_app_prep_db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3300 overwrite = TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3301 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3302 if (!result) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3303 write(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3304 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3305 "fatal error copying initial database '%s' to output '%s'",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3306 preproc_db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3307 ksea_app_prep_db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3308 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3309 stderr()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3310 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3311 if (sys.nframe() > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3312 cat("Cannot continue and quit() failed. Goodbye.")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3313 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3314 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3315 # in case knit_exit doesn't exit
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3316 quit(save = "no", status = 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3317 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3318 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3319
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3320 if (FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3321 write.table(x = param_df, file = "test-data/params.txt")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3322 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3323
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3324 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3325
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3326 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3327 ### READ DATA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3328
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3329 # read.table reads a file in table format and creates a data frame from it.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3330 # - note that `quote = ""` means that quotation marks are treated literally.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3331 full_data <- read.table(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3332 file = input_file,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3333 sep = "\t",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3334 header = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3335 quote = "",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3336 check.names = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3337 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3338
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3339 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3340
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3341
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3342 # Extraction of Sample Classes and Names from Input Data
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3343
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3344 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3345
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3346 data_column_indices <- grep(first_data_column, names(full_data), perl = TRUE)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3347 my_column_names <- names(full_data)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3348
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3349 if (!fdc_is_integer) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3350 if (length(data_column_indices) > 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3351 first_data_column <- data_column_indices[1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3352 } else {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3353 cat(paste("failed to convert firstDataColumn:", first_data_column))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3354 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3355 knitr::knit_exit()
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3356 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3357 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3358
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3359 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3360 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3361 paste(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3362 "\n\nThe input data file has peptide-intensity data",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3363 "in columns %d (\"%s\") through %d (\"%s\")."
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3364 ),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3365 tmp <- min(data_column_indices),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3366 my_column_names[tmp],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3367 tmp <- max(data_column_indices),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3368 my_column_names[tmp]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3369 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3370 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3371
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3372 if (TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3373 cat0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3374 table_offset(i = 1, new = TRUE),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3375 "Sample classes and names are shown in ",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3376 table_href(),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3377 ".\n\n"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3378 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3379 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3380 cat0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3381 "\\newcounter{offset}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3382 "\\setcounter{offset}{\\value{table}}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3383 "\\stepcounter{offset}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3384 "Sample classes and names are shown in ",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3385 table_href(),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3386 ".\n\n"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3387 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3388 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3389
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3390 #TODO remove this unused variable and assignment
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3391 if (FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3392 # Write column names as a LaTeX enumerated list.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3393 column_name_df <- data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3394 column = seq_len(length(colnames(full_data))),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3395 name = paste0("\\verb@", colnames(full_data), "@")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3396 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3397 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3398
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3399 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3400
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3401 ```{r echo = FALSE, results = 'asis'}
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3402 # extract intensity columns from full_data to quant_data
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3403 quant_data <- full_data[first_data_column:length(full_data)]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3404 quant_data[quant_data == 0] <- NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3405 rownames(quant_data) <- rownames(full_data) <- full_data$Phosphopeptide
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3406 full_data_names <- colnames(quant_data)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3407 # Extract factors and trt-replicates using regular expressions.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3408 # Typically:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3409 # regex_sample_names is "\\.\\d+[A-Z]$"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3410 # regex_sample_grouping is "\\d+"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3411 # This would distinguish trt-replicates by terminal letter [A-Z]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3412 # in sample names and group them into trts by the preceding digits.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3413 # e.g.:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3414 # group .1A .1B .1C into group 1;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3415 # group .2A .2B .2C, into group 2;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3416 # etc.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3417 m <- regexpr(regex_sample_names, colnames(quant_data), perl = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3418 sample_name_matches <- regmatches(names(quant_data), m)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3419 colnames(quant_data) <- sample_name_matches
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3420
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3421 write_debug_file(quant_data)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3422
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3423 rx_match <- regexpr(regex_sample_grouping, sample_name_matches, perl = TRUE)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3424 smpl_trt <- as.factor(regmatches(sample_name_matches, rx_match))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3425
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3426 if (print_nb_messages) nbe(see_variable(smpl_trt, "\n\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3427 if (print_nb_messages) nbe(see_variable(sample_name_matches, "\n\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3428 if (print_nb_messages) nbe(see_variable(full_data_names, "\n\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3429
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3430 sample_treatment_df <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3431 save_sample_treatment_df <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3432 data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3433 class = smpl_trt,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3434 sample = sample_name_matches,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3435 full_sample_names = full_data_names
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3436 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3437
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3438 if (print_nb_messages) nbe(see_variable(sample_treatment_df, "\n\n"))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3439
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3440 # reorder data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3441 my_order <- with(sample_treatment_df, order(class, sample))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3442 quant_data <- quant_data[, my_order]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3443 sample_name_matches <- sample_name_matches[my_order]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3444 smpl_trt <- smpl_trt[my_order]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3445 sample_treatment_df <- data.frame(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3446 class = smpl_trt,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3447 sample = sample_name_matches
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3448 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3449
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3450 # filter smpl_trt as appropriate
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3451 if (sample_group_filter %in% c("include", "exclude")) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3452 include_sample <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3453 mgrepl(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3454 v = sample_group_filter_patterns,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3455 s = as.character(smpl_trt),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3456 fixed = sample_group_filter_fixed,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3457 perl = sample_group_filter_perl,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3458 ignore.case = sample_group_filter_nocase
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3459 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3460 if (sum(include_sample) < 2) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3461 errmsg <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3462 paste(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3463 "ERROR:",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3464 sum(include_sample),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3465 "samples are too few for analysis;",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3466 "check input parameters for sample-name parsing"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3467 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3468 cat0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3469 errmsg,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3470 "\\stepcounter{offset}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3471 " in ",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3472 table_href(),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3473 ".\n\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3474 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3475 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3476 x = save_sample_treatment_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3477 tabstops = c(1.25, 1.25),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3478 caption = "Sample classes",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3479 use_subsubsection_header = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3480 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3481 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3482 x =
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3483 param_df[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3484 c("regexSampleNames",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3485 "regexSampleGrouping",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3486 "groupFilterPatterns",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3487 "groupFilter",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3488 "groupFilterMode"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3489 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3490 ],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3491 tabstops = c(1.75),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3492 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3493 caption = "Input parameters for sample-name parsing",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3494 verbatim = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3495 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3496 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3497 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3498 return(invisible(-1))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3499 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3500 sample_treatment_df <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3501 if (sample_group_filter == "include")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3502 sample_treatment_df[include_sample, ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3503 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3504 sample_treatment_df[!include_sample, ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3505 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3506 include_sample <- rep.int(TRUE, length(smpl_trt))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3507 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3508 sample_name_matches <- sample_treatment_df$sample
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3509 rx_match <- regexpr(regex_sample_grouping, sample_name_matches, perl = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3510 smpl_trt <- as.factor(regmatches(sample_name_matches, rx_match))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3511 sample_treatment_df$class <- smpl_trt
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3512
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3513 # filter quant_data as appropriate
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3514 number_of_samples <- length(sample_name_matches)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3515 quant_data <- quant_data[, sample_name_matches]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3516
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3517 sample_level_integers <- as.integer(smpl_trt)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3518 sample_treatment_levels <- levels(smpl_trt)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3519 count_of_treatment_levels <- length(sample_treatment_levels)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3520
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3521 # for each phosphopeptide, across treatment levels, compute minimum
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3522 # count of observed (i.e., non-missing) values
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3523 my_env <- new_env()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3524 for (l in sample_treatment_levels)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3525 my_env[[as.character(l)]] <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3526 as.vector(rowSums(!is.na(quant_data[l == smpl_trt])))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3527 min_group_obs_count <- row_apply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3528 x = Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3529 f = function(l, r) cbind(l, my_env[[r]]),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3530 x = sample_treatment_levels,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3531 init = c()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3532 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3533 fun = min
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3534 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3535 names(min_group_obs_count) <- rownames(quant_data)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3536 rm(my_env)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3537
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3538 # display (possibly-filtered) results
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3539 cat("\\newpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3540
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3541 if (sum(include_sample) > 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3542 data_frame_tabbing_latex(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3543 x = sample_treatment_df,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3544 tabstops = c(1.25),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3545 caption = "Sample classes",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3546 use_subsubsection_header = FALSE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3547 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3548 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3549 sample_name_grow <- 10 / (10 + max(nchar(sample_name_matches) + 6))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3550 sample_colsep <- transition_positions(as.integer(sample_treatment_df$class))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3551 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3552
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3553 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3554 cat("\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3555 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3556
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3557 ## Are the log-transformed sample distributions similar?
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3558
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3559 ```{r echo = FALSE, fig.dim = c(9, 6.5), results = 'asis'}
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3560
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3561 quant_data[quant_data == 0] <- NA #replace 0 with NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3562 quant_data_log <- log10(quant_data)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3563
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3564 rownames(quant_data_log) <- rownames(quant_data)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3565 colnames(quant_data_log) <- sample_name_matches
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3566
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3567 write_debug_file(quant_data_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3568
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3569 g_ppep_distrib_ctl <- new_env()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3570 g_ppep_distrib_ctl$xlab_line <- 3.5 + 11.86 * (0.67 - sample_name_grow)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3571 g_ppep_distrib_ctl$mai_bottom <- (0.5 + 3.95 * (0.67 - sample_name_grow))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3572 g_ppep_distrib_ctl$axis <- (0.6 + 0.925 * (0.67 - sample_name_grow))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3573
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3574 my_ppep_distrib_bxp <- function(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3575 x
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3576 , sample_name_grow = sample_name_grow
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3577 , main
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3578 , varwidth = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3579 , sub = NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3580 , xlab
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3581 , ylab
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3582 , col = const_boxplot_fill
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3583 , notch = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3584 , ppep_distrib_ctl = g_ppep_distrib_ctl
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3585 , ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3586 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3587 my_xlab_line <- g_ppep_distrib_ctl$xlab_line
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3588 my_mai_bottom <- g_ppep_distrib_ctl$mai_bottom
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3589 my_axis <- g_ppep_distrib_ctl$axis
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3590
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3591 if (print_trace_messages) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3592 cat_variable(my_xlab_line, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3593 cat_variable(my_mai_bottom, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3594 cat_variable(my_axis, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3595 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3596
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3597 old_par <- par(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3598 mai = par("mai") + c(my_mai_bottom, 0, 0, 0),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3599 cex.axis = my_axis,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3600 cex.lab = 1.2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3601 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3602 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3603 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3604 # Vertical plot
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3605 boxplot(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3606 x
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3607 , las = 2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3608 , col = col
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3609 , main = main
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3610 , sub = NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3611 , ylab = ylab
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3612 , xlab = NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3613 , notch = notch
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3614 , varwidth = varwidth
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3615 , ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3616 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3617 title(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3618 sub = sub
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3619 , cex.sub = 1.0
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3620 , line = my_xlab_line + 1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3621 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3622 title(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3623 xlab = xlab
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3624 , line = my_xlab_line
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3625 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3626 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3627 finally = par(old_par)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3628 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3629 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3630
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3631 my_ppep_distrib_bxp(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3632 x = quant_data_log
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3633 , sample_name_grow = sample_name_grow
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3634 , main = "Peptide intensities for each sample"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3635 , varwidth = boxplot_varwidth
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3636 , sub = "Box widths reflect number of peptides for sample"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3637 , xlab = "Sample"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3638 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3639 , col = const_boxplot_fill
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3640 , notch = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3641 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3642
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3643 cat("\n\n\n\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3644
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3645 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3646
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3647 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 4), results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3648 if (nrow(quant_data_log) > 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3649 quant_data_log_stack <- stack(quant_data_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3650 ggplot2::ggplot(quant_data_log_stack, ggplot2::aes(x = values)) +
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3651 ggplot2::xlab(latex2exp::TeX("$log_{10}$(peptide intensity)")) +
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3652 ggplot2::ylab("Probability density") +
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3653 ggplot2::geom_density(ggplot2::aes(group = ind, colour = ind), na.rm = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3654 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3655 cat("No density plot because there are too few peptides.\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3656 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3657 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3658
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3659 ## Globally, are peptide intensities are approximately unimodal?
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3660
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3661 <!--
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3662 # bquote could be used as an alternative to latex2exp::TeX below particularly
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3663 # and when plotting math expressions generally, at the expense of mastering
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3664 # another syntax, which hardly seems worthwhile when I need to use TeX
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3665 # elsewhere; here's an introduction to bquote:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3666 # https://www.r-bloggers.com/2018/03/math-notation-for-r-plot-titles-expression-and-bquote/
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3667 -->
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3668 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 5), results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3669
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3670 # identify the location of missing values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3671 fin <- is.finite(as.numeric(as.matrix(quant_data_log)))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3672
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3673 logvalues <- as.numeric(as.matrix(quant_data_log))[fin]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3674 logvalues_density <- density(logvalues)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3675 plot(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3676 x = logvalues_density,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3677 main = latex2exp::TeX(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3678 "Smoothed estimated probability density vs. $log_{10}$(peptide intensity)"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3679 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3680 xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3681 ylab = "Probability density"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3682 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3683 hist(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3684 x = as.numeric(as.matrix(quant_data_log)),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3685 xlim = c(min(logvalues_density$x), max(logvalues_density$x)),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3686 breaks = 100,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3687 main = latex2exp::TeX("Frequency vs. $log_{10}$(peptide intensity)"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3688 xlab = latex2exp::TeX("$log_{10}$(peptide intensity)")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3689 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3690 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3691
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3692 # Characterization of Input Data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3693
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3694 ## Distribution of standard deviations of $log_{10}(\text{intensity})$, ignoring missing values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3695
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3696 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 5), results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3697 # determine quantile
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3698 q1 <- quantile(logvalues, probs = mean_percentile)[1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3699
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3700 # 1 = row of matrix (ie, phosphopeptide)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3701 sds <- row_apply(quant_data_log, sd_finite)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3702 if (sum(!is.na(sds)) > 2) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3703 plot(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3704 density(sds, na.rm = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3705 , main = "Smoothed estimated probability density vs. std. deviation"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3706 , sub = "(probability estimation made with Gaussian smoothing)"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3707 , ylab = "Probability density"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3708 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3709 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3710 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3711 "At least two non-missing values are required to plot",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3712 "probability density.\n\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3713 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3714 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3715
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3716 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3717
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3718 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3719 # Determine number of cells to impute
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3720 temp <- quant_data[is.na(quant_data)]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3721
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3722 # Determine number of values to impute
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3723 number_to_impute <- length(temp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3724
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3725 # Determine percent of missing values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3726 pct_missing_values <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3727 round(length(temp) / (length(logvalues) + length(temp)) * 100)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3728 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3729
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3730 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3731
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3732 # prep for trt-median based imputation
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3733
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3734 ```
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3735 # Imputation of Missing Values
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3736
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3737 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3738
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3739 imp_smry_pot_peptides_before <- nrow(quant_data_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3740 imp_smry_missing_values_before <- number_to_impute
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3741 imp_smry_pct_missing <- pct_missing_values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3742
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3743 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3744
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3745 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3746 #Determine number of cells to impute
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3747
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3748 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3749 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3750
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3751 # Identify which values are missing and need to be imputed
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3752 ind <- which(is.na(quant_data), arr.ind = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3753
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3754 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3755 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3756
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3757 # Apply imputation
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3758 switch(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3759 imputation_method
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3760 , "group-median" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3761 quant_data_imp <- quant_data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3762 imputation_method_description <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3763 paste("Substitute missing value with",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3764 "median peptide-intensity for sample group.\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3765 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3766 # Take the accurate ln(x+1) because the data are log-normally distributed
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3767 # and because median can involve an average of two measurements.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3768 quant_data_imp <- log1p(quant_data_imp)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3769 for (i in seq_len(count_of_treatment_levels)) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3770 # Determine the columns for this factor-level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3771 level_cols <- i == sample_level_integers
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3772 # Extract those columns
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3773 lvlsbst <- quant_data_imp[, level_cols, drop = FALSE]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3774 # assign to ind the row-column pairs corresponding to each NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3775 ind <- which(is.na(lvlsbst), arr.ind = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3776 # No group-median exists if there is only one sample
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3777 # a given ppep has no measurement; otherwise, proceed.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3778 if (ncol(lvlsbst) > 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3779 the_centers <-
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3780 row_apply(lvlsbst, median, na.rm = TRUE)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3781 for (j in seq_len(nrow(lvlsbst))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3782 for (k in seq_len(ncol(lvlsbst))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3783 if (is.na(lvlsbst[j, k])) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3784 lvlsbst[j, k] <- the_centers[j]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3785 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3786 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3787 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3788 quant_data_imp[, level_cols] <- lvlsbst
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3789 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3790 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3791 # Take the accurate e^x - 1 to match scaling of original input.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3792 quant_data_imp <- round(expm1(quant_data_imp_ln <- quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3793 good_rows <- !is.na(rowMeans(quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3794 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3795 , "median" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3796 quant_data_imp <- quant_data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3797 imputation_method_description <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3798 paste("Substitute missing value with",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3799 "median peptide-intensity across all sample classes.\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3800 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3801 # Take the accurate ln(x+1) because the data are log-normally distributed
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3802 # and because median can involve an average of two measurements.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3803 quant_data_imp <- log1p(quant_data_imp)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3804 quant_data_imp[ind] <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3805 row_apply(quant_data_imp, median, na.rm = TRUE)[ind[, 1]]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3806 # Take the accurate e^x - 1 to match scaling of original input.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3807 quant_data_imp <- round(expm1(quant_data_imp_ln <- quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3808 good_rows <- !is.nan(rowMeans(quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3809 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3810 , "mean" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3811 quant_data_imp <- quant_data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3812 imputation_method_description <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3813 paste("Substitute missing value with",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3814 "geometric-mean peptide intensity across all sample classes.\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3815 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3816 # Take the accurate ln(x+1) because the data are log-normally distributed,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3817 # so arguments to mean should be previously transformed.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3818 # this will have to be
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3819 quant_data_imp <- log1p(quant_data_imp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3820 # Assign to NA cells the mean for the row
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3821 quant_data_imp[ind] <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3822 row_apply(quant_data_imp, mean, na.rm = TRUE)[ind[, 1]]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3823 # Take the accurate e^x - 1 to match scaling of original input.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3824 quant_data_imp <- round(expm1(quant_data_imp_ln <- quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3825 good_rows <- !is.nan(rowMeans(quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3826 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3827 , "random" = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3828 quant_data_imp <- quant_data
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3829 # sd to be used is the median sd
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3830 m1 <- median(sds, na.rm = TRUE) * sd_percentile
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3831 # If you want results to be reproducible, you will want to call
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3832 # base::set.seed before calling stats::rnorm
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3833 imputation_method_description <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3834 paste("Substitute each missing value with random intensity",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3835 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3836 "random intensity $N \\sim (%0.2f, %0.2f)$.\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3837 q1, m1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3838 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3839 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3840 cat(sprintf("mean_percentile (from input parameter) is %2.0f\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3841 100 * mean_percentile))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3842 cat(sprintf("sd_percentile (from input parameter) is %0.2f\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3843 sd_percentile))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3844 quant_data_imp[ind] <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3845 10 ^ rnorm(number_to_impute, mean = q1, sd = m1)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3846 quant_data_imp_ln <- log1p(quant_data_imp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3847 good_rows <- !is.nan(rowMeans(quant_data_imp))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3848 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3849 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3850 quant_data_imp_log10 <- quant_data_imp_ln * const_log10_e
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3851
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3852 if (length(good_rows) < 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3853 print("ERROR: Cannot impute data; there are no good rows!")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3854 return(-1)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3855 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3856 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3857
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3858 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3859 cat("\\quad\n\nImputation method:\n\n\n", imputation_method_description)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3860 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3861
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3862 ```{r echo = FALSE}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3863
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3864 imp_smry_pot_peptides_after <- sum(good_rows)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3865 imp_smry_rejected_after <- sum(!good_rows)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3866 imp_smry_missing_values_after <- sum(is.na(quant_data_imp[good_rows, ]))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3867
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
3868 # From ?`%in%`:
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3869 # %in% is currently defined
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3870 # as function(x, table) match(x, table, nomatch = 0) > 0
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3871
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3872 stock_in <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3873 names(good_rows) %in%
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3874 names(min_group_obs_count[g_intensity_min_per_class <= min_group_obs_count])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3875 if (print_nb_messages) nbe(see_variable(stock_in), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3876
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3877 explicit_in <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3878 0 < match(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3879 names(good_rows),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3880 names(min_group_obs_count[g_intensity_min_per_class <= min_group_obs_count])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3881 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3882 if (print_nb_messages) nbe(see_variable(explicit_in), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3883
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3884 great_enough_row_names <- good_rows[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3885 names(good_rows) %in%
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3886 names(min_group_obs_count[g_intensity_min_per_class <= min_group_obs_count])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3887 ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3888 if (print_nb_messages) nbe(see_variable(great_enough_row_names), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3889 great_enough_row_names <- great_enough_row_names[great_enough_row_names]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3890 if (print_nb_messages) nbe(see_variable(great_enough_row_names), "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3891 ```
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3892
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3893 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3894 # ref: http://www1.maths.leeds.ac.uk/latex/TableHelp1.pdf
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3895 tabular_lines_fmt <- paste(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3896 "\\begin{table}[hb]", # h(inline); b(bottom); t (top) or p (separate page)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3897 " \\leavevmode",
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3898 " \\caption{Imputation Results}",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3899 " \\centering", # \centering centers the table on the page
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3900 " \\begin{tabular}{l c c c}",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3901 " \\hline\\hline",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3902 " \\ & potential peptides & missing values & rejected",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3903 " peptides \\\\ [0.5ex]",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3904 " \\hline",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3905 " before imputation & %d & %d (%d\\%s) & \\\\",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3906 " after imputation & %d & %d & %d \\\\",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3907 " after keep comparable & %d & & %d \\\\ [1ex]",
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3908 " \\hline",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3909 " \\end{tabular}",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3910 #" \\label{table:nonlin}", # may be used to refer this table in the text
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3911 "\\end{table}",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3912 sep = "\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3913 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3914 tabular_lines <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3915 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3916 tabular_lines_fmt,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3917 imp_smry_pot_peptides_before,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3918 imp_smry_missing_values_before,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3919 imp_smry_pct_missing,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3920 "%",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3921 imp_smry_pot_peptides_after,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3922 imp_smry_missing_values_after,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3923 imp_smry_rejected_after,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3924 length(great_enough_row_names),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3925 imp_smry_pot_peptides_before -
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3926 length(great_enough_row_names)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3927 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3928 cat(tabular_lines)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3929 ```
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3930
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3931 ```{r filter_good_rows, echo = FALSE}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3932
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3933 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3934 "before name extraction, ", see_variable(length(good_rows)), " ",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3935 see_variable(good_rows), "\n")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3936 good_rows <- names(good_rows[names(great_enough_row_names)])
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3937 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3938 "after name extraction, ", see_variable(length(good_rows)),
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3939 see_variable(good_rows), "\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3940
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3941 min_group_obs_count <- min_group_obs_count[good_rows]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3942
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3943 # Zap rows where imputation was insufficiently effective
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3944 full_data <- full_data [good_rows, ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3945 quant_data <- quant_data [good_rows, ]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3946 quant_data_log <- quant_data_log [good_rows, ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
3947
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3948 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3949 "before row filter, ", see_variable(nrow(quant_data_imp)), "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3950 quant_data_imp <- quant_data_imp[good_rows, ]
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3951 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
3952 "after row filter, ", see_variable(nrow(quant_data_imp)), "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3953 write_debug_file(quant_data_imp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3954 quant_data_imp_good_rows <- quant_data_imp
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3955
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3956 write_debug_file(quant_data_imp_good_rows)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3957 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3958
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3959 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3960
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3961 can_plot_before_after_imp <- TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3962 d_combined <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3963 as.numeric(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3964 as.matrix(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3965 log10(quant_data_imp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3966 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3967 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3968 d_original <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3969 as.numeric(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3970 as.matrix(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3971 log10(quant_data_imp[!is.na(quant_data)])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3972 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3973 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3974
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3975 if (sum(!is.na(d_original)) > 2) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3976 d_original <- density(d_original)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3977 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3978 can_plot_before_after_imp <- FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3979 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3980 if (can_plot_before_after_imp && sum(is.na(d_combined)) < 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3981 d_combined <- density(d_combined)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3982 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3983 can_plot_before_after_imp <- FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3984 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3985
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3986 if (sum(is.na(quant_data)) > 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3987 # There ARE missing values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3988 d_imputed <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3989 as.numeric(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3990 as.matrix(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3991 log10(quant_data_imp[is.na(quant_data)])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3992 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3993 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3994 if (can_plot_before_after_imp && sum(is.na(d_imputed)) < 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3995 d_imputed <- (density(d_imputed))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3996 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3997 can_plot_before_after_imp <- FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3998 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
3999 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4000 # There are NO missing values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4001 d_imputed <- d_combined
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4002 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4003
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4004 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4005
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4006 ```{r echo = FALSE, fig.dim = c(9, 6.5), results = 'asis'}
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4007 zero_sd_rownames <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4008 rownames(quant_data_imp)[
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4009 is.na((row_apply(quant_data_imp, sd, na.rm = TRUE)) == 0)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4010 ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4011
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4012 if (length(zero_sd_rownames) >= nrow(quant_data_imp)) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4013 cat("All peptides have zero standard deviation. Cannot continue.")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4014 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4015 knitr::knit_exit()
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4016 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4017 if (length(zero_sd_rownames) > 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4018 cat(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4019 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4020 "%d %s %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4021 length(zero_sd_rownames),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4022 "peptides with zero variance",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4023 "were removed from statistical consideration"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4024 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4025 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4026 zap_named_rows <- function(df, nms) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4027 return(df[!(row.names(df) %in% nms), ])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4028 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4029 quant_data_imp <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4030 zap_named_rows(quant_data_imp, zero_sd_rownames)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4031 quant_data <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4032 zap_named_rows(quant_data, zero_sd_rownames)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4033 full_data <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4034 zap_named_rows(full_data, zero_sd_rownames)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4035 min_group_obs_count <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4036 min_group_obs_count[names(min_group_obs_count) %notin% zero_sd_rownames]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4037 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4038
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4039 if (sum(is.na(quant_data)) > 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4040 cat("\\leavevmode\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4041 # Copy quant data to x
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4042 x <- quant_data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4043 # x gets to have values of:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4044 # - NA for observed values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4045 # - 1 for missing values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4046 x[is.na(x)] <- 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4047 x[x > 1] <- NA
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4048 x[x == 0] <- 1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4049 # Log-transform imputed data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4050 # update variable because rows may have been eliminated from quant_data_imp
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4051 quant_data_imp_log10 <- log10(quant_data_imp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4052
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4053 write_debug_file(quant_data_imp_log10)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4054
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4055 # Set blue_dots to log of quant data or NA for NA quant data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4056 blue_dots <- log10(quant_data)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4057 # Set red_dots to log of imputed data or NA for observed quant data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4058 red_dots <- quant_data_imp_log10 * x
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4059
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4060 count_red <- sum(!is.na(red_dots))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4061 count_blue <- sum(!is.na(blue_dots))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4062 ylim_save <- ylim <- c(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4063 min(red_dots, blue_dots, na.rm = TRUE),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4064 max(red_dots, blue_dots, na.rm = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4065 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4066 show_stripchart <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4067 50 > (count_red + count_blue) / length(sample_name_matches)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4068 if (show_stripchart) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4069 boxplot_sub <- "Light blue = data before imputation; Red = imputed data;"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4070 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4071 boxplot_sub <- ""
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4072 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4073
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4074 # Vertical plot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4075 colnames(blue_dots) <- sample_name_matches
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4076 my_ppep_distrib_bxp(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4077 x = blue_dots
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4078 , sample_name_grow = sample_name_grow
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4079 , main = "Peptide intensities after eliminating unusable peptides"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4080 , varwidth = boxplot_varwidth
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4081 , sub = paste(boxplot_sub,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4082 "Box widths reflect number of peptides for sample")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4083 , xlab = "Sample"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4084 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4085 , col = const_boxplot_fill
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4086 , notch = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4087 , ylim = ylim
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4088 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4089
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4090 if (show_stripchart) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4091 # Points
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4092 # ref: https://r-charts.com/distribution/add-points-boxplot/
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4093 # NA values are not plotted
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4094 stripchart(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4095 blue_dots, # Data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4096 method = "jitter", # Random noise
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4097 jitter = const_stripchart_jitter,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4098 pch = 19, # Pch symbols
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4099 cex = const_stripchart_cex, # Size of symbols reduced
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4100 col = "lightblue", # Color of the symbol
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4101 vertical = TRUE, # Vertical mode
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4102 add = TRUE # Add it over
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4103 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4104 stripchart(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4105 red_dots, # Data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4106 method = "jitter", # Random noise
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4107 jitter = const_stripchart_jitter,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4108 pch = 19, # Pch symbols
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4109 cex = const_stripchart_cex, # Size of symbols reduced
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4110 col = "red", # Color of the symbol
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4111 vertical = TRUE, # Vertical mode
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4112 add = TRUE # Add it over
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4113 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4114
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4115 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4116 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4117 ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4118
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4119 ```{r echo = FALSE, fig.dim = c(9, 5.5), results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4120 if (sum(is.na(quant_data)) > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4121 # show measured values in blue on left half-violin plot
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4122 cat("\\leavevmode\n\\quad\n\n\\quad\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4123 old_par <- par(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4124 mai = par("mai") + c(g_ppep_distrib_ctl$mai_bottom, 0, 0, 0),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4125 cex.axis = g_ppep_distrib_ctl$axis,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4126 cex.lab = 1.2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4127 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4128 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4129 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4130 vioplot::vioplot(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4131 x = lapply(blue_dots, function(x) x[!is.na(x)]),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4132 col = "lightblue1",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4133 side = "left",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4134 plotCentre = "line",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4135 ylim = ylim_save,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4136 main = "Distributions of observed and imputed data",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4137 sub = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4138 las = 2,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4139 xlab = NULL,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4140 ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4141 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4142 title(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4143 sub = "Light blue = observed data; Pink = imputed data",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4144 cex.sub = 1.0,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4145 line = g_ppep_distrib_ctl$xlab_line + 1
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4146 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4147 title(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4148 xlab = "Sample",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4149 line = g_ppep_distrib_ctl$xlab_line
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4150 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4151 red_violins <- lapply(red_dots, function(x) x[!is.na(x)])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4152 cols_to_delete <- c()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4153 for (ix in seq_len(length(red_violins))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4154 if (length(red_violins[[ix]]) < 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4155 cols_to_delete <- c(cols_to_delete, ix)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4156 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4157 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4158 # destroy any unimputable columns
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4159 if (!is.null(cols_to_delete)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4160 red_violins <- red_violins[-cols_to_delete]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4161 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4162 # plot imputed values in red on right half-violin plot
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4163 vioplot::vioplot(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4164 x = red_violins,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4165 col = "lightpink1",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4166 side = "right",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4167 plotCentre = "line",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4168 add = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4169 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4170
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4171 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4172 finally = par(old_par)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4173 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4174
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4175 # density plot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4176 cat("\\leavevmode\n\n\n\n\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4177 if (can_plot_before_after_imp) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4178 ylim <- c(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4179 0,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4180 max(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4181 if (is.list(d_combined)) d_combined$y else d_combined,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4182 if (is.list(d_original)) d_original$y else d_original,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4183 if (is.list(d_imputed)) d_imputed$y else d_imputed,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4184 na.rm = TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4185 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4186 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4187 plot(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4188 d_combined,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4189 ylim = ylim,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4190 sub =
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4191 paste(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4192 "Blue = data before imputation; Red = imputed data;",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4193 "Black = combined"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4194 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4195 main = "Density of peptide intensity before and after imputation",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4196 xlab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4197 ylab = "Probability density"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4198 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4199 lines(d_original, col = "blue")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4200 lines(d_imputed, col = "red")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4201 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4202 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4203 "There are too few points to plot the density of peptide intensity",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4204 "before and after imputation."
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4205 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4206 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4207 cat("\\leavevmode\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4208 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4209 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4210
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4211 # Quantile Normalization
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4212
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4213 The excellent `normalize.quantiles` function from
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4214 *[the `preprocessCore` Bioconductor package](http://bioconductor.org/packages/release/bioc/html/preprocessCore.html)*
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4215 performs "quantile normalization" as described Bolstad *et al.* (2003),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4216 DOI *[10.1093/bioinformatics/19.2.185](https://doi.org/10.1093%2Fbioinformatics%2F19.2.185)*
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4217 and its supplementary material [http://bmbolstad.com/misc/normalize/normalize.html](http://bmbolstad.com/misc/normalize/normalize.html),
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4218 i.e., it assumes that the goal is to detect
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4219 subtle differences among grossly similar samples (having similar distributions)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4220 by equalizing intra-quantile quantitations^[Unfortunately,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4221 one software library upon which `preprocessCore` depends
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4222 *[suffers from a concurrency defect](https://support.bioconductor.org/p/122925/#9135989)*
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4223 that requires that a specific, non-concurrent version of the library (`openblas` version $0.3.3$) be
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4224 installed. The installation command equivalent to what was used to install the library to produce the results presented here is:
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4225 \linebreak
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4226 ` conda install bioconductor-preprocesscore openblas=0.3.3`].
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4227
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4228
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4229 <!--
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4230 # Apply quantile normalization using preprocessCore::normalize.quantiles
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4231 # ---
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4232 # tool repository: http://bioconductor.org/packages/release/bioc/html/preprocessCore.html
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4233 # except this: https://support.bioconductor.org/p/122925/#9135989
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4234 # says to install it like this:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4235 # ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4236 # BiocManager::install("preprocessCore", configure.args="--disable-threading", force = TRUE, lib=.libPaths()[1])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4237 # ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4238 # conda installation (necessary because of a bug in recent openblas):
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4239 # conda install bioconductor-preprocesscore openblas=0.3.3
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4240 # ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4241 # ---
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4242 # normalize.quantiles {preprocessCore} -- Quantile Normalization
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4243 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4244 # Description:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4245 # Using a normalization based upon quantiles, this function normalizes a
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4246 # matrix of probe level intensities.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4247 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4248 # THIS FUNCTIONS WILL HANDLE MISSING DATA (ie NA values), based on the
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4249 # assumption that the data is missing at random.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4250 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4251 # Usage:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4252 # normalize.quantiles(x, copy = TRUE, keep.names = FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4253 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4254 # Arguments:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4255 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4256 # - x: A matrix of intensities where each column corresponds to a chip and each row is a probe.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4257 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4258 # - copy: Make a copy of matrix before normalizing. Usually safer to work with a copy,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4259 # but in certain situations not making a copy of the matrix, but instead normalizing
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4260 # it in place will be more memory friendly.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4261 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4262 # - keep.names: Boolean option to preserve matrix row and column names in output.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4263 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4264 # Details:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4265 # This method is based upon the concept of a quantile-quantile plot extended to n dimensions.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4266 # No special allowances are made for outliers. If you make use of quantile normalization
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4267 # please cite Bolstad et al, Bioinformatics (2003).
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4268 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4269 # This functions will handle missing data (ie NA values), based on
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4270 # the assumption that the data is missing at random.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4271 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4272 # Note that the current implementation optimizes for better memory usage
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4273 # at the cost of some additional run-time.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4274 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4275 # Value: A normalized matrix.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4276 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4277 # Author: Ben Bolstad, bmbolstad.com
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4278 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4279 # References
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4280 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4281 # - Bolstad, B (2001) Probe Level Quantile Normalization of High Density Oligonucleotide
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4282 # Array Data. Unpublished manuscript http://bmbolstad.com/stuff/qnorm.pdf
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4283 #
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4284 # - Bolstad, B. M., Irizarry R. A., Astrand, M, and Speed, T. P. (2003) A Comparison of
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4285 # Normalization Methods for High Density Oligonucleotide Array Data Based on Bias
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4286 # and Variance. Bioinformatics 19(2), pp 185-193. DOI 10.1093/bioinformatics/19.2.185
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4287 # http://bmbolstad.com/misc/normalize/normalize.html
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4288 # ...
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4289 -->
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4290 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4291
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4292 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp)), "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4293 if (nrow(quant_data_imp) > 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4294 quant_data_imp_qn <- preprocessCore::normalize.quantiles(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4295 as.matrix(quant_data_imp), keep.names = TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4296 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4297 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4298 quant_data_imp_qn <- as.matrix(quant_data_imp)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4299 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4300
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4301 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp_qn)), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4302
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4303 quant_data_imp_qn <- as.data.frame(quant_data_imp_qn)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4304 write_debug_file(quant_data_imp_qn)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4305
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4306 quant_data_imp_qn_log <- log10(quant_data_imp_qn)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4307 write_debug_file(quant_data_imp_qn_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4308
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4309 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp_qn_log)), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4310 if (print_nb_messages) nbe(see_variable(ncol(quant_data_imp_qn_log)), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4311
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4312 quant_data_imp_qn_ls <- t(scale(t(log10(quant_data_imp_qn))))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4313
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4314 sel <- row_apply(quant_data_imp_qn_ls, any_nan)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4315 quant_data_imp_qn_ls2 <- quant_data_imp_qn_ls
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4316
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4317 quant_data_imp_qn_ls2 <- quant_data_imp_qn_ls2[which(sel), ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4318 quant_data_imp_qn_ls2 <- as.data.frame(quant_data_imp_qn_ls2)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4319
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4320 quant_data_imp_qn_ls <- as.data.frame(quant_data_imp_qn_ls)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4321
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4322 write_debug_file(quant_data_imp_qn_ls)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4323 write_debug_file(quant_data_imp_qn_ls2)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4324
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4325 # Create data.frame used by ANOVA analysis
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4326 data_table_imp_qn_lt <- cbind(full_data[1:9], quant_data_imp_qn_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4327 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4328
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4329 ## Are normalized, imputed, log-transformed sample distributions similar?
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4330
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4331 ```{r echo = FALSE, fig.dim = c(9, 6.5), results = 'asis'}
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4332
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4333 # Save unimputed quant_data_log for plotting below
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4334 unimputed_quant_data_log <- quant_data_log
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4335
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4336 # log10 transform (after preparing for zero values,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4337 # which should never happen...)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4338 quant_data_imp_qn[quant_data_imp_qn == 0] <- .000000001
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4339 quant_data_log <- log10(quant_data_imp_qn)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4340
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4341 how_many_peptides <- nrow(quant_data_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4342
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4343 if ((how_many_peptides) > 0) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4344 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4345 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4346 "Intensities for %d peptides:\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4347 how_many_peptides
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4348 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4349 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4350 cat("\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4351
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4352
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4353 # data visualization
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4354 if (TRUE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4355
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4356 my_ppep_distrib_bxp(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4357 x = quant_data_log
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4358 , sample_name_grow = sample_name_grow
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4359 , main = "Peptide intensities for each sample"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4360 , varwidth = boxplot_varwidth
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4361 , sub = NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4362 , xlab = "Sample"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4363 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4364 , col = const_boxplot_fill
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4365 , notch = boxplot_notch
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4366 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4367
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4368 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4369
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4370 old_par <- par(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4371 mai = par("mai") + c(0.5, 0, 0, 0)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4372 , oma = par("oma") + c(0.5, 0, 0, 0)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4373 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4374 # ref: https://r-charts.com/distribution/add-points-boxplot/
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4375 # Vertical plot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4376 colnames(quant_data_log) <- sample_name_matches
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4377 boxplot(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4378 quant_data_log
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4379 , las = 2
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4380 , cex.axis = 0.9 * sample_name_grow
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4381 , col = const_boxplot_fill
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4382 , ylab = latex2exp::TeX("$log_{10}$(peptide intensity)")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4383 , xlab = "Sample"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4384 , notch = boxplot_notch
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4385 , varwidth = boxplot_varwidth
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4386 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4387 par(old_par)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4388 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4389 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4390 cat("There are no peptides to plot\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4391 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4392
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4393 cat("\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4394
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4395 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4396
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4397 ```{r echo = FALSE, fig.align = "left", fig.dim = c(9, 4), results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4398 if (nrow(quant_data_log) > 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4399 quant_data_log_stack <- stack(quant_data_log)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4400 ggplot2::ggplot(quant_data_log_stack, ggplot2::aes(x = values)) +
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4401 ggplot2::xlab(latex2exp::TeX("$log_{10}$(peptide intensity)")) +
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4402 ggplot2::ylab("Probability density") +
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4403 ggplot2::geom_density(ggplot2::aes(group = ind, colour = ind), na.rm = TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4404 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4405 cat("No density plot because there are fewer than two peptides to plot.\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4406 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4407 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4408 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4409 cat("\\leavevmode\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4410 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4411
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4412 # ANOVA Analysis
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4413
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4414 ## Assignment of $p$-value and quality score
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4415
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4416 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.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4417
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4418 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).
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4419
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4420 Furthermore, to give more weight to phosphopeptides having fewer missing values, an (arbitrarily defined) quality score was assigned to each, defined as:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4421
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4422 $$
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4423 \textit{quality}_j
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4424 = \frac{1 + o_{j}}{v_{j}(1 + o_{j}) + 0.005}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4425 $$
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4426
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4427 where:
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4428
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4429 - $o_j$ is the minimum number of non-missing observations per sample group for substrate $j$ for all sample groups, and
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4430 - $v_j$ is the FDR-adjusted ANOVA $p$-value for substrate $j$.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4431
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4432
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4433 ```{r, echo = FALSE, results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4434 cat("\\newpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4435
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4436 # Make new data frame containing only Phosphopeptides
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4437 # to connect preANOVA to ANOVA (connect_df)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4438 connect_df <- data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4439 data_table_imp_qn_lt$Phosphopeptide
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4440 , data_table_imp_qn_lt[, first_data_column]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4441 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4442 colnames(connect_df) <- c("Phosphopeptide", "Intensity")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4443 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4444
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4445 ```{r anova, echo = FALSE, fig.dim = c(10, 12), results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4446 g_can_run_ksea <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4447 old_oma <- par("oma")
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4448
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4449 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4450 # squash un-actionable cyclomatic_complexity warning
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4451 if (count_of_treatment_levels < 2) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4452 # nolint end
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4453 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4454 "ERROR!!!! Cannot perform ANOVA analysis",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4455 "(see next page)\\newpage\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4456 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4457 cat(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4458 "ERROR: ANOVA analysis",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4459 "requires two or more factor levels!\n\n\n"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4460 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4461
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4462 cat("\n\n\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4463 cat("Unparsed sample names are:\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4464 "\\begin{quote}\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4465 paste(names(quant_data_imp_qn_log), collapse = "\n\n\n"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4466 "\n\\end{quote}\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4467
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4468 regex_sample_names <- latex_printable_control_seqs(regex_sample_names)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4469
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4470 cat("\\leavevmode\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4471 cat("Parsing rule for SampleNames is",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4472 "\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4473 "\\text{'",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4474 regex_sample_names,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4475 "'}\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4476 sep = ""
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4477 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4478
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4479 cat("\nParsed sample names are:\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4480 "\\begin{quote}\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4481 paste(sample_name_matches, collapse = "\n\n\n"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4482 "\n\\end{quote}\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4483
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4484 regex_sample_grouping <- latex_printable_control_seqs(regex_sample_grouping)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4485
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4486 cat("\\leavevmode\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4487 cat("Parsing rule for SampleGrouping is",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4488 "\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4489 "\\text{'",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4490 regex_sample_grouping,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4491 "'}\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4492 sep = ""
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4493 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4494
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4495 cat("\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4496 cat("Sample group assignments are:\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4497 "\\begin{quote}\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4498 paste(regmatches(sample_name_matches, rx_match), collapse = "\n\n\n"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4499 "\n\\end{quote}\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4500
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4501 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4502
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4503 if (print_nb_messages) nbe("computing p_value_data_anova_ps\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4504 if (print_nb_messages) nbe(see_variable(nrow(quant_data_imp_qn_log)), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4505 if (print_nb_messages) nbe(see_variable(ncol(quant_data_imp_qn_log)), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4506 if (print_nb_messages) nbe(see_variable(quant_data_imp_qn_log), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4507 if (print_nb_messages) nbe(see_variable(anova_func), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4508 if (print_nb_messages) nbe(see_variable(smpl_trt), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4509 if (print_nb_messages) nbe(see_variable(one_way_all_categories), "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4510 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4511 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4512 p_value_data_anova_ps <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4513 row_apply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4514 quant_data_imp_qn_log,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4515 anova_func,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4516 grouping_factor = smpl_trt,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4517 one_way_f = one_way_all_categories
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4518 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4519 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4520 error = function(e) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4521 mesg <- paste("Could not compute ANOVA because", e$message)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4522 cat("\n\n", mesg, "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4523 param_df_noexit(e)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4524 sink(stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4525 cat("\n\n", mesg, "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4526 values <- paste(param_df$parameter, "=", param_df$value, collapse = "\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4527 cat(values)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4528 sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4529 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4530 exit(code = 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4531 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4532 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4533 if (print_nb_messages) nbe(see_variable(p_value_data_anova_ps), "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4534
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4535 p_value_data_anova_ps_fdr <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4536 p.adjust(p_value_data_anova_ps, method = "fdr")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4537 my_ppep_v <- full_data[, 1]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4538 p_value_data <- list(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4539 phosphopeptide = my_ppep_v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4540 raw_anova_p = p_value_data_anova_ps,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4541 fdr_adjusted_anova_p = p_value_data_anova_ps_fdr,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4542 missing_values = rowSums(is.na(quant_data)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4543 min_group_obs_count = min_group_obs_count
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4544 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4545 p_value_data <- data.frame(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4546 phosphopeptide = my_ppep_v,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4547 raw_anova_p = p_value_data_anova_ps,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4548 fdr_adjusted_anova_p = p_value_data_anova_ps_fdr,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4549 missing_values = rowSums(is.na(quant_data)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4550 min_group_obs_count = min_group_obs_count
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4551 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4552 p_value_data$quality <- 1.0 / with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4553 p_value_data,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4554 fdr_adjusted_anova_p + 0.005 / (1 + min_group_obs_count)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4555 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4556
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4557 p_value_data$ranking <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4558 with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4559 p_value_data,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4560 switch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4561 g_intensity_hm_criteria,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4562 "quality" = order(-quality),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4563 "na_count" = order(missing_values, fdr_adjusted_anova_p),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4564 # the default is "p_value"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4565 order(fdr_adjusted_anova_p)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4566 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4567 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4568 p_value_data <- p_value_data[p_value_data$ranking, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4569
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4570 write.table(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4571 p_value_data,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4572 file = "p_value_data.txt",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4573 sep = "\t",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4574 col.names = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4575 row.names = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4576 quote = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4577 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4578
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4579
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4580 # output ANOVA file to constructed filename,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4581 # e.g. "Outputfile_pST_ANOVA_STEP5.txt"
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4582 # becomes "Outputfile_pST_ANOVA_STEP5_FDR0.05.txt"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4583
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4584 # Re-output datasets to include p-values
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4585 metadata_plus_p <- cbind(full_data[1:9], p_value_data[, 2:ncol(p_value_data)])
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4586 write.table(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4587 cbind(metadata_plus_p, quant_data_imp),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4588 file = imputed_data_filename,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4589 sep = "\t",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4590 col.names = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4591 row.names = FALSE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4592 quote = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4593 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4594
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4595 write.table(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4596 cbind(metadata_plus_p, quant_data_imp_qn_log),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4597 file = imp_qn_lt_data_filenm,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4598 sep = "\t",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4599 col.names = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4600 row.names = FALSE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4601 quote = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4602 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4603
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4604
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4605 first_page_suppress <- 1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4606 number_of_peptides_found <- 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4607 cutoff <- val_fdr[1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4608 for (cutoff in val_fdr) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4609 #loop through FDR cutoffs
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4610 if (number_of_peptides_found > g_intensity_hm_rows - 1) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4611 cat("\\leavevmode\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4612 break
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4613 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4614
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4615 if (print_trace_messages) {
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4616 cat_variable(cutoff)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4617 cat("\n\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4618 }
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4619
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4620 bool_1 <- (p_value_data$fdr_adjusted_anova_p < cutoff)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4621 bool_2 <- (p_value_data$min_group_obs_count >= g_intensity_min_per_class)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4622 g_can_run_ksea <- g_can_run_ksea || (sum(bool_2) > 0)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4623 bool_4 <- (p_value_data$quality >= params$minQuality)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4624 bool_3 <- as.logical(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4625 as.integer(bool_1) *
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4626 as.integer(bool_2) *
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4627 as.integer(bool_4)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4628 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4629 if (print_trace_messages) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4630 if (length(bool_1) > 30) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4631 cat_variable(bool_1, force_str = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4632 cat_variable(bool_2, force_str = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4633 cat_variable(bool_3, force_str = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4634 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4635 cat_variable(bool_1, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4636 cat_variable(bool_2, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4637 cat_variable(bool_3, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4638 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4639 cat_variable(length(bool_3), digits = 0, suffix = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4640 cat_variable(sum(bool_3), digits = 0, suffix = "\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4641 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4642
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4643 filtered_p <-
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4644 p_value_data[bool_3, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4645 filtered_p <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4646 filtered_p[!is.na(filtered_p$phosphopeptide), , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4647
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4648 if (print_trace_messages)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4649 cat_variable(filtered_p, force_str = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4650
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4651 have_remaining_peptides <- sum(bool_3, na.rm = TRUE) > 0
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4652
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4653 filter_result_string <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4654 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4655 "%s, %s of %0.0f peptides remained having both %s and %s.\n\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4656 "After filtering for ANOVA results",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4657 if (have_remaining_peptides)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4658 as.character(sum(bool_3, na.rm = TRUE))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4659 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4660 "none",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4661 length(bool_3),
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4662 adj_p_string <-
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4663 sprintf("adjusted p-value < %s", as.character(signif(cutoff, 2))),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4664 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4665 "more than %0.0f observations in some groups",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4666 max(0, g_intensity_min_per_class - 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4667 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4668 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4669
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4670 filtered_data_filtered <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4671 quant_data_imp_qn_log[
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4672 rownames(filtered_p),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4673 , drop = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4674 ]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4675 # order by p-value
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4676 filtered_data_filtered <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4677 filtered_data_filtered[
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4678 order(filtered_p$fdr_adjusted_anova_p),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4679 , drop = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4680 ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4681
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4682 if (have_remaining_peptides
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4683 && nrow(filtered_p) > 0
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4684 && nrow(filtered_data_filtered) > 0
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4685 ) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4686 if (first_page_suppress == 1) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4687 first_page_suppress <- 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4688 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4689 cat("\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4690 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4691 latex_samepage({
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4692 cat(filter_result_string)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4693 if (nrow(filtered_data_filtered) > 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4694 cat(subsection_header(sprintf(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4695 "Intensity distributions for %d phosphopeptides, %s\n",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4696 nrow(filtered_data_filtered),
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4697 adj_p_string
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4698 )))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4699 } else {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4700 cat(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4701 subsection_header(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4702 sprintf(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4703 "Intensity distribution for one phosphopeptide, %s\n",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4704 adj_p_string
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4705 )
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4706 ),
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4707 rownames(filtered_data_filtered)[1],
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4708 "\n"
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4709 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4710 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4711 }) # end latex_samepage
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4712
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4713 old_par <- par(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4714 mai = (par("mai") + c(0.7, 0, 0, 0)) * c(1, 1, 0.3, 1),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4715 oma = old_oma * c(1, 1, 0.3, 1),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4716 cex.main = 0.9,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4717 cex.axis = 0.7,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4718 fin = c(9, 7.25)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4719 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4720 # Vertical plot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4721 colnames(filtered_data_filtered) <- sample_name_matches
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4722 tryCatch(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4723 boxplot(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4724 filtered_data_filtered,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4725 main = "Imputed, normalized intensities", # no line plot
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4726 las = 2,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4727 cex.axis = 0.9 * sample_name_grow,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4728 col = const_boxplot_fill,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4729 ylab = latex2exp::TeX("$log_{10}$(peptide intensity)"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4730 notch = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4731 varwidth = boxplot_varwidth
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4732 ),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4733 error = function(e) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4734 print(e)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4735 cat_margins()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4736 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4737
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4738 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4739 par(old_par)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4740 } else {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4741 cat(sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4742 "%s < %0.2f\n\n\n\n\n",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4743 "No peptides were found to have cutoff adjusted p-value",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4744 cutoff
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4745 ))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4746 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4747
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4748 if (have_remaining_peptides && nrow(filtered_data_filtered) > 0) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4749 # Add Phosphopeptide column to anova_filtered table
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4750 # The assumption here is that the first intensity is unique;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4751 # this is a hokey assumption but almost definitely will
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4752 # be true in the real world unless there is a computation
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4753 # error upstream.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4754 anova_filtered_merge <- base::merge(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4755 x = connect_df,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4756 y = filtered_data_filtered,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4757 by.x = "Intensity",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4758 by.y = 1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4759 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4760 anova_filtered_merge_order <- rownames(filtered_p)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4761
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4762 anova_filtered <- data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4763 ppep = anova_filtered_merge$Phosphopeptide,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4764 intense = anova_filtered_merge$Intensity,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4765 data = anova_filtered_merge[, 2:number_of_samples + 1]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4766 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4767 colnames(anova_filtered) <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4768 c("Phosphopeptide", colnames(filtered_data_filtered))
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4769
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4770 # Merge qualitative columns into the ANOVA data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4771 output_table <- data.frame(anova_filtered$Phosphopeptide)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4772 output_table <- base::merge(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4773 x = output_table,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4774 y = data_table_imp_qn_lt,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4775 by.x = "anova_filtered.Phosphopeptide",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4776 by.y = "Phosphopeptide"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4777 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4778
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4779 # Produce heatmap to visualize significance and the effect of imputation
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4780
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4781 cat_hm_heading <- function(m, cutoff) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4782 if (nrow(m) > g_intensity_hm_rows) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4783 cat("\\clearpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4784 cat(subsection_header(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4785 paste(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4786 sprintf("Heatmap for the %d most-significant peptides",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4787 g_intensity_hm_rows),
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4788 sprintf("whose adjusted p-value < %0.2f\n", cutoff)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4789 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4790 ))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4791 } else {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4792 if (nrow(m) < 2) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4793 return(FALSE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4794 } else {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4795 cat(subsection_header(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4796 paste(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4797 sprintf("Heatmap for %d usable peptide genes whose", nrow(m)),
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4798 sprintf("adjusted p-value < %0.2f\n", cutoff)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4799 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4800 ))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4801 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4802 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4803 cat("\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4804 cat("\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4805 return(TRUE)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4806 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4807
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4808 # construct matrix with appropriate rownames
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4809 m <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4810 as.matrix(unimputed_quant_data_log[anova_filtered_merge_order, ])
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4811 nrow_m <- nrow(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4812 ncol_m <- ncol(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4813 if (nrow_m > 0) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4814 rownames_m <- rownames(m)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4815 q <- data.frame(pepname = rownames_m)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4816 g <- sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4817 SELECT q.pepname, substr(met.Gene_Name, 1, 30) AS gene_name
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4818 FROM q, metadata_plus_p AS met
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4819 WHERE q.pepname = met.Phosphopeptide
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4820 ORDER BY q.rowid
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4821 ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4822 tmp <- sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4823 X = seq_len(nrow(g)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4824 FUN = function(i) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4825 pre <- strsplit(g$gene_name[i], "; ")[[1]]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4826 rslt <- paste(unique(pre), sep = "; ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4827 return(rslt)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4828 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4829 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4830 tmp <- unlist(tmp)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4831 tmp <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4832 make.names(tmp, unique = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4833 tmp <- sub(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4834 "No_Gene_Name",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4835 "not_found",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4836 tmp,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4837 fixed = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4838 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4839 ten_trunc_names <- trunc_ppep(rownames_m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4840 tmp <- sapply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4841 X = seq_len(nrow_m),
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4842 FUN = function(i) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4843 sprintf(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4844 "(%s) %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4845 tmp[i],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4846 ten_trunc_names[i]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4847 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4848 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4849 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4850 rownames(m) <- tmp
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4851 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4852 # draw the heading and heatmap
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4853 if (nrow_m > 0) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4854 number_of_peptides_found <-
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4855 ppep_heatmap(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4856 m = m,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4857 cutoff = cutoff,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4858 hm_heading_function = cat_hm_heading,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4859 hm_main_title =
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4860 "log(intensities), row-scaled, unimputed, unnormalized",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4861 suppress_row_dendrogram = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4862 master_cex = 0.35,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4863 sepcolor = "black",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4864 colsep = sample_colsep
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4865 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4866 if (number_of_peptides_found > 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4867 cat("\\leavevmode\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4868 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4869 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4870 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4871 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4872 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4873
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4874 cat("\\leavevmode\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4875
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4876 if (!g_can_run_ksea) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4877 errmsg <- paste("Cannot proceed with KSEA analysis",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4878 "because too many values are missing.")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4879 if (FALSE) cat0(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4880 errmsg,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4881 "\\stepcounter{offset}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4882 "\\stepcounter{offset}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4883 "\\stepcounter{offset}\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4884 " in ",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4885 table_href(),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4886 ".\n\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4887 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4888 if (FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4889 if (print_nb_messages) nbe(see_variable(p_value_data))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4890 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4891 if (print_nb_messages) nbe(see_variable(p_value_data))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4892
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4893 display_p_value_data <- p_value_data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4894 display_p_value_data$raw_anova_p <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4895 sprintf("%0.3g", display_p_value_data$raw_anova_p)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4896 display_p_value_data$fdr_adjusted_anova_p <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4897 sprintf("%0.3g", display_p_value_data$fdr_adjusted_anova_p)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4898 display_p_value_data$quality <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4899 sprintf("%0.3g", display_p_value_data$quality)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4900
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4901 headers_1st_line <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4902 c("", "Raw ANOVA", "FDR-adj.", "Missing", "Min. #",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4903 "", "")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4904 headers_2nd_line <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4905 c("Phosphopeptide", "p-value", "p-value", "values", "group-obs",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
4906 "Quality", "Ranking")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4907 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4908 x = display_p_value_data,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4909 tabstops = c(2.75, 0.80, 0.80, 0.5, 0.6, 0.60),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4910 use_subsubsection_header = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4911 headings = c(headers_1st_line, headers_2nd_line),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4912 caption = "ANOVA results"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4913
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4914 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4915 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4916 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4917 x = save_sample_treatment_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4918 tabstops = c(1.25, 1.25),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4919 caption = "Sample classes",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4920 use_subsubsection_header = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4921 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4922 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4923 knitr::knit_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4924 return(invisible(-1))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4925 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4926
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4927 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4928
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4929 ```{r sqlite, echo = FALSE, fig.dim = c(9, 10), results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4930
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4931 if (g_can_run_ksea && count_of_treatment_levels > 1) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4932 # Prepare two-way contrasts with adjusted p-values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4933 # Strategy:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4934 # - use imputed, log-transformed data:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4935 # - remember this when computing log2(fold-change)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4936 # - each contrast is between a combination of trt levels
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4937 # - for each contrast, compute samples that are members
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4938 # - compute one-way test:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4939 # - use `oneway.test` (Welch test) if numbers of samples
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4940 # are not equivalent between trt levels
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4941 # - otherwise, aov is fine but offers no advantage
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4942 # - adjust p-value, assuming that
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4943 # (# of pppeps)*(# of contrasts) tests were performed
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4944
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4945 # Each contrast is between a combination of trt levels
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4946 m2 <- combn(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4947 x = seq_len(length(levels(smpl_trt))),
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4948 m = 2,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4949 simplify = TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4950 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4951 contrast_count <- ncol(m2)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4952
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4953 # For each contrast, compute samples that are members
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4954 # - local function to construct a data.frame for each contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4955 # - the contrast in the first "column"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4956 f_m2 <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4957 function(cntrst, lvl1, lvl2) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4958 return(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4959 data.frame(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4960 contrast = cntrst,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4961 level = smpl_trt[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4962 smpl_trt %in%
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4963 levels(smpl_trt)[c(lvl1, lvl2)]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4964 ],
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4965 label = sample_name_matches[
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4966 smpl_trt %in%
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
4967 levels(smpl_trt)[c(lvl1, lvl2)]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4968 ]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4969 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4970 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4971 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4972 # - compute a df for each contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4973 sample_level_dfs <- lapply(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4974 X = 1:contrast_count,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4975 FUN = function(i) f_m2(i, m2[1, i], m2[2, i])
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4976 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4977 # - compute a single df for all contrasts
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4978 combined_contrast_df <- Reduce(f = rbind, x = sample_level_dfs)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4979
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4980 # - dispose objects to free resources
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4981 rm(sample_level_dfs)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4982
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4983 # - write the df to a DB for later join-per-contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4984 db <- RSQLite::dbConnect(RSQLite::SQLite(), ksea_app_prep_db)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4985
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4986 RSQLite::dbWriteTable(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4987 conn = db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4988 name = "contrast",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4989 value = combined_contrast_df,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4990 overwrite = TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4991 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4992
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4993 # Create UK for insert
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4994 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4995 CREATE UNIQUE INDEX IF NOT EXISTS contrast__uk__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4996 ON contrast(contrast, label);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4997 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4998 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
4999 # Create indexes for join
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5000 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5001 -- index for join in contrast_ppep_smpl_qnlt on a.label < b.label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5002 CREATE INDEX IF NOT EXISTS contrast__label__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5003 ON contrast(label);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5004 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5005 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5006 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5007 -- index for joining two contrast_lvl_ppep_avg_quant on contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5008 CREATE INDEX IF NOT EXISTS contrast__contrast__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5009 ON contrast(contrast);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5010 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5011 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5012 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5013 -- index for joining two contrast_lvl_ppep_avg_quant on phophospep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5014 CREATE INDEX IF NOT EXISTS contrast__level__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5015 ON contrast(level);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5016 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5017 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5018 # - dispose objects to free resources
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5019 rm(combined_contrast_df)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5020
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5021 # Use imputed, log-transformed data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5022 # - remember that this was donoe when computing log2(fold-change)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5023 # - melt data matrix for use in later join-per-contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5024 casted <- cbind(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5025 data.frame(vrbl = rownames(quant_data_imp_qn_log)),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5026 quant_data_imp_qn_log
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5027 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5028 quant_data_imp_qn_log_melted <- reshape2::melt(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5029 casted,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5030 id.vars = "vrbl"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5031 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5032 colnames(quant_data_imp_qn_log_melted) <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5033 c("phosphopep", "sample", "quant")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5034 # - dispose objects to free resources
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5035 rm(casted)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5036
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5037 # - write the df to a DB for use in later join-per-contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5038 RSQLite::dbWriteTable(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5039 conn = db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5040 name = "ppep_smpl_qnlt",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5041 value = quant_data_imp_qn_log_melted,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5042 overwrite = TRUE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5043 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5044 # Create UK for insert
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5045 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5046 CREATE UNIQUE INDEX IF NOT EXISTS ppep_smpl_qnlt__uk__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5047 ON ppep_smpl_qnlt(phosphopep, sample);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5048 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5049 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5050 # Create index for join
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5051 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5052 -- index for join in contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5053 CREATE INDEX IF NOT EXISTS ppep_smpl_qnlt__sample__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5054 ON ppep_smpl_qnlt(sample);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5055 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5056 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5057 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5058 -- index for joining two contrast_lvl_ppep_avg_quant on phopho.pep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5059 CREATE INDEX IF NOT EXISTS ppep_smpl_qnlt__phosphopep__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5060 ON ppep_smpl_qnlt(phosphopep);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5061 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5062 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5063 # - dispose objects to free resources
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5064 rm(quant_data_imp_qn_log_melted)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5065
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5066 # - drop views if exist
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5067 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5068 -- drop view dependent on contrast_lvl_ppep_avg_quant
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5069 DROP VIEW IF EXISTS v_contrast_log2_fc;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5070 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5071 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5072 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5073 -- drop table dependent on contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5074 DROP TABLE IF EXISTS contrast_lvl_ppep_avg_quant;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5075 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5076 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5077 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5078 DROP TABLE IF EXISTS contrast_lvl_lvl_metadata;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5079 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5080 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5081 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5082 DROP VIEW IF EXISTS v_contrast_lvl_metadata;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5083 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5084 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5085 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5086 -- drop view dependent on contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5087 DROP VIEW IF EXISTS v_contrast_lvl_ppep_avg_quant;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5088 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5089 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5090 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5091 DROP VIEW IF EXISTS v_contrast_lvl_lvl;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5092 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5093 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5094 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5095 -- drop view upon which other views depend
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5096 DROP VIEW IF EXISTS contrast_ppep_smpl_qnlt;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5097 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5098 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5099 # - create view
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5100 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5101 -- view contrast_ppep_smpl_qnlt is used for each phopshopep to
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5102 -- compute p-value for test of trt effect for two trt levels
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5103 CREATE VIEW contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5104 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5105 SELECT contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5106 level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5107 phosphopep,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5108 sample,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5109 quant
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5110 FROM contrast AS c,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5111 ppep_smpl_qnlt AS q
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5112 WHERE q.sample = c.label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5113 ORDER BY contrast, level, phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5114 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5115 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5116 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5117 # - create simplification views
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5118 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5119 CREATE VIEW v_contrast_lvl_metadata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5120 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5121 SELECT contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5122 level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5123 group_concat(label, ';') AS samples
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5124 FROM contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5125 GROUP BY contrast, level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5126 /* view v_contrast_lvl_metadata is used
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5127 to simplify creation of table contrast_lvl_lvl_metadata */
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5128 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5129 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5130 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5131 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5132 CREATE VIEW v_contrast_lvl_ppep_avg_quant
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5133 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5134 SELECT contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5135 level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5136 phosphopep,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5137 avg(quant) AS avg_quant
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5138 FROM contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5139 GROUP BY contrast, level, phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5140 /* view v_contrast_lvl_ppep_avg_quant is used
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5141 to simplify view v_contrast_log2_fc */
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5142 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5143 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5144 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5145
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5146 # - create contrast-metadata table
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5147 if (print_nb_messages) nbe("CREATE TABLE contrast_lvl_lvl_metadata")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5148 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5149 CREATE TABLE contrast_lvl_lvl_metadata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5150 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5151 SELECT DISTINCT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5152 a.contrast AS ab_contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5153 a.level AS a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5154 b.level AS b_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5155 a.samples AS a_samples,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5156 b.samples AS b_samples,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5157 'log2(level_'||a.level||'/level_'||b.level||')'
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5158 AS fc_description
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5159 FROM v_contrast_lvl_metadata AS a,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5160 v_contrast_lvl_metadata AS b
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5161 WHERE a.contrast = b.contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5162 AND a.level > b.level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5163 /* view v_contrast_lvl_lvl is used
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5164 to simplify view v_contrast_log2_fc */
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5165 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5166 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5167 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5168 # - create pseudo-materialized view table
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5169 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5170 CREATE VIEW v_contrast_lvl_lvl
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5171 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5172 SELECT DISTINCT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5173 a.contrast AS ab_contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5174 a.level AS a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5175 b.level AS b_level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5176 FROM contrast AS a,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5177 contrast AS b
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5178 WHERE a.contrast = b.contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5179 AND a.level > b.level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5180 /* view v_contrast_lvl_lvl is used
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5181 to simplify view v_contrast_log2_fc */
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5182 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5183 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5184 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5185
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5186 # - create view to compute log2(fold-change)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5187 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5188 CREATE VIEW v_contrast_log2_fc
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5189 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5190 SELECT ab.ab_contrast AS contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5191 m.a_level AS a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5192 c.avg_quant AS a_quant,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5193 m.a_samples AS a_samples,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5194 ab.b_level AS b_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5195 d.avg_quant AS b_quant,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5196 m.b_samples AS b_samples,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5197 m.fc_description AS fc_description,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5198 3.32193 * ( d.avg_quant - c.avg_quant) AS log2_fc,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5199 d.phosphopep AS phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5200 FROM contrast_lvl_lvl_metadata AS m,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5201 v_contrast_lvl_ppep_avg_quant AS d,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5202 v_contrast_lvl_lvl AS ab
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5203 INNER JOIN v_contrast_lvl_ppep_avg_quant AS c
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5204 ON c.contrast = ab.ab_contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5205 AND c.level = ab.a_level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5206 WHERE d.contrast = ab.ab_contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5207 AND m.ab_contrast = ab.ab_contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5208 AND d.level = ab.b_level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5209 AND d.phosphopep = c.phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5210 /* view to compute log2(fold-change) */
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5211 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5212 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5213 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5214
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5215 # For each contrast, compute samples that are members
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5216 # compute one-way test:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5217 # - use `oneway.test` (Welch test) if numbers of samples
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5218 # are not equivalent between trt levels
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5219 # - otherwise, aov is fine but offers no advantage
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5220 for (contrast in contrast_count:2) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5221 invisible(contrast)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5222 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5223 for (contrast in 1:contrast_count) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5224 contrast_df <- sqldf::sqldf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5225 x = paste0("
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5226 SELECT level, phosphopep, sample, quant
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5227 FROM contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5228 WHERE contrast = ", contrast, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5229 ORDER BY phosphopep, level, sample
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5230 "),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5231 connection = db
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5232 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5233 contrast_cast <- reshape2::dcast(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5234 data = contrast_df,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5235 formula = phosphopep ~ sample,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5236 value.var = "quant"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5237 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5238 contrast_cast_ncol <- ncol(contrast_cast)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5239 contrast_cast_data <- contrast_cast[, 2:contrast_cast_ncol]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5240 contrast_cast_samples <- colnames(contrast_cast_data)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5241
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5242 # - order grouping_factor by order of sample columns of contrast_cast_data
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5243 grouping_factor <- sqldf::sqldf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5244 x = paste0("
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5245 SELECT sample, level
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5246 FROM contrast_ppep_smpl_qnlt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5247 WHERE contrast = ", contrast, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5248 ORDER BY phosphopep, level, sample
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5249 LIMIT ", contrast_cast_ncol - 1
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5250 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5251 connection = db
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5252 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5253 rownames(grouping_factor) <- grouping_factor$sample
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5254 grouping_factor <- grouping_factor[, "level", drop = FALSE]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5255
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5256 # - run the two-level (one-way) test
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5257 p_value_data_contrast_ps <-
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5258 row_apply(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5259 x = contrast_cast_data,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5260 fun = anova_func,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5261 grouping_factor =
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5262 as.factor(grouping_factor$level), # anova_func arg2
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5263 one_way_f = one_way_two_categories, # anova_func arg3
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5264 simplify = TRUE # TRUE is the default for simplify
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5265 )
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5266
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5267 if (!is.null(p_value_data_contrast_ps)) {
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5268 contrast_data_adj_p_values <-
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5269 p.adjust(
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5270 p = p_value_data_contrast_ps,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5271 method = "fdr",
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5272 n = length(p_value_data_contrast_ps) # this is the default, length(p)
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5273 )
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5274
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5275 # - compute the fold-change
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5276 contrast_p_df <-
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5277 data.frame(
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5278 contrast = contrast,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5279 phosphopep = contrast_cast$phosphopep,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5280 p_value_raw = p_value_data_contrast_ps,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5281 p_value_adj = contrast_data_adj_p_values
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5282 )
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5283 db_write_table_overwrite <- (contrast < 2)
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5284 db_write_table_append <- !db_write_table_overwrite
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5285 RSQLite::dbWriteTable(
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5286 conn = db,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5287 name = "contrast_ppep_p_val",
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5288 value = contrast_p_df,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5289 append = db_write_table_append
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5290 )
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5291 # Create UK for insert
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5292 ddl_exec(db, "
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5293 CREATE UNIQUE INDEX IF NOT EXISTS contrast_ppep_p_val__uk__idx
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5294 ON contrast_ppep_p_val(phosphopep, contrast);
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5295 "
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5296 )
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
5297 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5298 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5299 # Perhaps this could be done more elegantly using unique keys
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5300 # or creating the tables before saving data to them, but this
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5301 # is fast and, if the database exists on disk rather than in
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5302 # memory, it doesn't stress memory.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5303 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5304 CREATE TEMP table contrast_log2_fc
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5305 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5306 SELECT *
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5307 FROM v_contrast_log2_fc
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5308 ORDER BY contrast, phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5309 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5310 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5311 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5312 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5313 CREATE TEMP table ppep_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5314 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5315 SELECT p_value_raw,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5316 p_value_adj,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5317 contrast AS p_val_contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5318 phosphopep AS p_val_ppep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5319 FROM contrast_ppep_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5320 ORDER BY contrast, phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5321 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5322 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5323 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5324 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5325 DROP TABLE IF EXISTS contrast_log2_fc_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5326 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5327 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5328 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5329 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5330 CREATE TABLE contrast_log2_fc_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5331 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5332 SELECT a.*,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5333 b.p_value_raw,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5334 b.p_value_adj,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5335 b.p_val_contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5336 b.p_val_ppep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5337 FROM contrast_log2_fc a, ppep_p_val b
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5338 WHERE a.rowid = b.rowid
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5339 AND a.phosphopep = b.p_val_ppep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5340 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5341 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5342 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5343 # Create UK
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5344 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5345 CREATE UNIQUE INDEX IF NOT EXISTS contrast_log2_fc_p_val__uk__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5346 ON contrast_log2_fc_p_val(phosphopep, contrast);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5347 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5348 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5349 # Create indices for future queries
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5350 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5351 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__contrast__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5352 ON contrast_log2_fc_p_val(contrast);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5353 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5354 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5355 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5356 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__phosphopep__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5357 ON contrast_log2_fc_p_val(phosphopep);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5358 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5359 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5360 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5361 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__p_value_raw__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5362 ON contrast_log2_fc_p_val(p_value_raw);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5363 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5364 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5365 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5366 CREATE INDEX IF NOT EXISTS contrast_log2_fc_p_val__p_value_adj__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5367 ON contrast_log2_fc_p_val(p_value_adj);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5368 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5369 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5370 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5371 DROP VIEW IF EXISTS v_contrast_log2_fc_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5372 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5373 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5374 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5375 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5376 CREATE VIEW v_contrast_log2_fc_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5377 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5378 SELECT contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5379 a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5380 a_samples,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5381 b_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5382 b_samples,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5383 a_quant,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5384 b_quant,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5385 fc_description,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5386 log2_fc,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5387 p_value_raw,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5388 p_value_adj,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5389 phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5390 FROM contrast_log2_fc_p_val
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5391 ORDER BY contrast, phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5392 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5393 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5394 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5395 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5396 DROP TABLE IF EXISTS kseaapp_metadata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5397 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5398 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5399 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5400 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5401 CREATE TABLE kseaapp_metadata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5402 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5403 WITH extended(deppep, ppep, gene_name, uniprot_id, phosphoresidue) AS (
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5404 SELECT DISTINCT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5405 deppep.seq,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5406 ppep.seq,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5407 GeneName||';',
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5408 UniProtID||';',
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5409 PhosphoResidue||';'
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5410 FROM
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5411 ppep, deppep, mrgfltr_metadata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5412 WHERE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5413 mrgfltr_metadata.ppep_id = ppep.id
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5414 AND
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5415 ppep.deppep_id = deppep.id
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5416 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5417 SELECT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5418 ppep AS `ppep`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5419 SUBSTR(uniprot_id, 1, INSTR(uniprot_id,';') - 1 ) AS `Protein`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5420 SUBSTR(gene_name, 1, INSTR(gene_name,';') - 1 ) AS `Gene`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5421 deppep AS `Peptide`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5422 REPLACE(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5423 REPLACE(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5424 SUBSTR(phosphoresidue, 1, INSTR(phosphoresidue,';') - 1 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5425 'p',
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5426 ''
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5427 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5428 ', ',
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5429 ';'
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5430 ) AS `Residue.Both`
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5431 FROM extended
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5432 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5433 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5434 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5435 # Create indexes for join
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5436 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5437 CREATE INDEX IF NOT EXISTS kseaapp_metadata__ppep__idx
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5438 ON kseaapp_metadata(ppep);
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5439 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5440 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5441 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5442 DROP VIEW IF EXISTS v_kseaapp_contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5443 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5444 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5445 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5446 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5447 CREATE VIEW v_kseaapp_contrast
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5448 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5449 SELECT a.*, b.Protein, b.Gene, b.Peptide, b.`Residue.Both`
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5450 FROM v_contrast_log2_fc_p_val a, kseaapp_metadata b
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5451 WHERE b.ppep = a.phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5452 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5453 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5454 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5455 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5456 DROP VIEW IF EXISTS v_kseaapp_input
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5457 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5458 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5459 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5460 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5461 CREATE VIEW v_kseaapp_input
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5462 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5463 SELECT v.contrast,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5464 v.phosphopep,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5465 m.`Protein`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5466 m.`Gene`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5467 m.`Peptide`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5468 m.`Residue.Both`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5469 v.p_value_raw AS `p`,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5470 v.log2_fc AS `FC`
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5471 FROM kseaapp_metadata AS m,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5472 v_contrast_log2_fc_p_val AS v
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5473 WHERE m.ppep = v.phosphopep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5474 AND NOT m.`Gene` = 'No_Gene_Name'
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5475 AND NOT v.log2_fc = 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5476 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5477 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5478 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5479 # We are done with DDL and insertion
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5480 RSQLite::dbDisconnect(db)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5481 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5482 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5483
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5484 ```{r echo = FALSE, results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5485 cat("\\newpage\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5486 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5487
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5488 # KSEA Analysis Summaries
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5489
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5490 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:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5491
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5492 - The package is available on CRAN, at https://cran.r-project.org/package=KSEAapp
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5493 - 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).
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5494 - An online alternative (supporting only analysis of human data) is available at [https://casecpb.shinyapps.io/ksea/](https://casecpb.shinyapps.io/ksea/).
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5495
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5496 For each kinase, $i$, and each two-way contrast of treatments, $j$, an enrichment $z$-score is computed as:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5497
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5498 $$
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5499 \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
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5500 $$
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5501
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5502 and fold-enrichment is computed as:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5503
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5504 $$
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5505 \text{Enrichment}_{j,i} = \frac{\overline{`r sfc`}_{j,i}}{\overline{`r pfc`}_j}
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5506 $$
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5507
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5508 where:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5509
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5510 - $\overline{`r sfc`}_{j,i}$ is the mean `r pfc_txt` in intensities of known substrates of the kinase $i$ in contrast $j$,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5511 - $\overline{`r pfc`}_j$ is the mean `r pfc_txt` of all phosphosites identified in contrast $j$, and
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5512 - $m_{j,i}$ is the total number of phosphosite substrates of kinase $i$ identified in contrast $j$,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5513 - $\delta_j$ is the standard deviation of the $\log_2 (\text{fold-change})$ for contrast $j$ across all phosphosites in the dataset.
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5514 - 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.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5515
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5516 $\text{FDR}_{j,i}$ is the False Discovery Rate corrected kinase enrichment score.
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5517
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5518 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).
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5519
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5520 Asterisks in heatmaps reflect enrichments that are significant at `r ksea_cutoff_statistic` < `r ksea_cutoff_threshold`.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5521
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5522 - 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.
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5523 - 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
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5524 - 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).
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5525
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5526 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".
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5527
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5528 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.
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5529
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5530 ```{r ksea, echo = FALSE, fig.dim = c(12, 14.5), results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5531 cat("\\clearpage\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5532
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5533 db <- RSQLite::dbConnect(RSQLite::SQLite(), ksea_app_prep_db)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5534
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5535 # -- eliminate the table that's about to be defined
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5536 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5537 DROP TABLE IF EXISTS site_metadata;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5538 ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5539
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5540 # -- define the site_metadata table
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5541 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5542 CREATE TABLE site_metadata(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5543 id INTEGER PRIMARY KEY
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5544 , site_type_id INTEGER REFERENCES site_type(id)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5545 , full TEXT UNIQUE ON CONFLICT IGNORE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5546 , abbrev TEXT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5547 , pattern TEXT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5548 , motif TEXT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5549 );
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5550 ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5551
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5552 # -- populate the table with initial values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5553 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5554 INSERT INTO site_metadata(full, abbrev, site_type_id)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5555 SELECT DISTINCT kinase_map, kinase_map, site_type_id
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5556 FROM ppep_gene_site
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5557 ORDER BY kinase_map;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5558 ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5559
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5560 # -- drop bogus KSData view if exists
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5561 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5562 DROP VIEW IF EXISTS ks_data_v;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5563 ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5564
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5565 # -- create view to serve as an impostor for KSEAapp::KSData
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5566 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5567 CREATE VIEW IF NOT EXISTS ks_data_v
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5568 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5569 SELECT
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5570 'NA' AS KINASE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5571 'NA' AS KIN_ACC_ID,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5572 kinase_map AS GENE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5573 'NA' AS KIN_ORGANISM,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5574 'NA' AS SUBSTRATE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5575 0 AS SUB_GENE_ID,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5576 'NA' AS SUB_ACC_ID,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5577 gene_names AS SUB_GENE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5578 'NA' AS SUB_ORGANISM,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5579 phospho_peptide AS SUB_MOD_RSD,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5580 0 AS SITE_GROUP_ID,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5581 'NA' AS 'SITE_7AA',
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5582 2 AS networkin_score,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5583 type_name AS Source
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5584 FROM ppep_gene_site_view;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5585 ")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5586
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5587 contrast_metadata_df <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5588 sqldf::sqldf("select * from contrast_lvl_lvl_metadata", connection = db)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5589 rslt <- new_env()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5590 rslt$score_list <- list()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5591 rslt$name_list <- list()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5592 rslt$longname_list <- list()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5593
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5594 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5595 DROP TABLE IF EXISTS contrast_ksea_scores;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5596 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5597 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5598
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5599 next_index <- 0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5600 err_na_subscr_df_const <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5601 "missing values are not allowed in subscripted assignments of data frames"
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5602
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5603 for (i_cntrst in seq_len(nrow(contrast_metadata_df))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5604 cntrst_a_level <- contrast_metadata_df[i_cntrst, "a_level"]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5605 cntrst_b_level <- contrast_metadata_df[i_cntrst, "b_level"]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5606 cntrst_fold_change <- contrast_metadata_df[i_cntrst, 6]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5607 contrast_label <- sprintf("%s -> %s", cntrst_b_level, cntrst_a_level)
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5608 contrast_longlabel <- (
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5609 sprintf(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5610 "Class %s -> Class %s",
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5611 contrast_metadata_df[i_cntrst, "b_level"],
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5612 contrast_metadata_df[i_cntrst, "a_level"]
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5613 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5614 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5615 kseaapp_input <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5616 sqldf::sqldf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5617 x = sprintf("
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5618 SELECT `Protein`,`Gene`,`Peptide`,phosphopep AS `Residue.Both`,`p`,`FC`
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5619 FROM v_kseaapp_input
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5620 WHERE contrast = %d
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5621 ",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5622 i_cntrst
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5623 ),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5624 connection = db
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5625 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5626
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5627 pseudo_ksdata <- dbReadTable(db, "ks_data_v")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5628
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5629 # This hack is because SQL table has the log2-transformed values
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5630 kseaapp_input[, "FC"] <- 2 ** kseaapp_input[, "FC", drop = TRUE]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5631 main_title <- (
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5632 sprintf(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5633 "Change from treatment %s to treatment %s",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5634 contrast_metadata_df[i_cntrst, "b_level"],
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5635 contrast_metadata_df[i_cntrst, "a_level"]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5636 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5637 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5638 sub_title <- contrast_longlabel
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5639 tryCatch(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5640 expr = {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5641 ksea_scores_rslt <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5642 ksea_scores(
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5643 ksdata = pseudo_ksdata,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5644 px = kseaapp_input,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5645 networkin = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5646 networkin_cutoff = 2,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5647 minimum_substrate_count = ksea_min_substrate_count
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5648 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5649
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5650 if (FALSE) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5651 ksea_scores_rslt <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5652 ksea_scores_rslt[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5653 ksea_scores_rslt$m >= ksea_min_substrate_count,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5654 ,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5655 drop = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5656 ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5657 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5658
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5659 if (FALSE) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5660 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5661 "Output contents of `ksea_scores_rslt` table\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5662 cat_variable(ksea_scores_rslt)
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5663 cat("\n\\clearpage\n")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5664 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5665 x = ksea_scores_rslt,
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5666 tabstops = c(1.8, 0.8, 0.8, 0.3, 0.8, 0.8),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5667 caption = paste("KSEA scores for contrast ",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5668 cntrst_b_level, "to", cntrst_a_level),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5669 use_subsubsection_header = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5670 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5671 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5672
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5673 if (0 < sum(!is.nan(ksea_scores_rslt$FDR))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5674 next_index <- 1 + next_index
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5675 rslt$score_list[[next_index]] <- ksea_scores_rslt
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5676 rslt$name_list[[next_index]] <- contrast_label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5677 rslt$longname_list[[next_index]] <- contrast_longlabel
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5678 ksea_low_fdr_print(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5679 rslt = rslt,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5680 i_cntrst = i_cntrst,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5681 i = next_index,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5682 a_level = cntrst_a_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5683 b_level = cntrst_b_level,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5684 fold_change = cntrst_fold_change,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5685 caption = contrast_longlabel
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5686 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5687 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5688 },
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5689 error = function(e) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5690 str(e)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5691 cat_margins()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5692 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5693 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5694 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5695
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5696 plotted_kinases <- NULL
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5697 if (g_can_run_ksea && length(rslt$score_list) > 1) {
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5698 for (i in seq_len(length(ksea_heatmap_titles))) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5699 hdr <- ksea_heatmap_titles[[i]]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5700 which_kinases <- i
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5701
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5702 cat("\\clearpage\n\\begin{center}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5703 if (i == const_ksea_astrsk_kinases) {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5704 cat(subsection_header(hdr))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5705 } else {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5706 cat(subsection_header(hdr))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5707 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5708 cat("\\end{center}\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5709
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5710 plotted_kinases <- ksea_heatmap(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5711 # the data frame outputs from the KSEA.Scores() function, in list format
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5712 score_list = rslt$score_list,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5713 # a character vector of all the sample names for heatmap annotation:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5714 # - the names must be in the same order as the data in score_list
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5715 # - please avoid long names, as they may get cropped in the final image
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5716 sample_labels = rslt$name_list,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5717 # character string of either "p.value" or "FDR" indicating the data column
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5718 # to use for marking statistically significant scores
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5719 stats = c("p.value", "FDR")[2],
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5720 # a numeric value between 0 and infinity indicating the min. number of
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5721 # substrates a kinase must have to be included in the heatmap
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5722 m_cutoff = 1,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5723 # a numeric value between 0 and 1 indicating the p-value/FDR cutoff
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5724 # for indicating significant kinases in the heatmap
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5725 p_cutoff = params$kseaCutoffThreshold,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5726 # a binary input of TRUE or FALSE, indicating whether or not to perform
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5727 # hierarchical clustering of the sample columns
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5728 sample_cluster = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5729 # a binary input of TRUE or FALSE, indicating whether or not to export
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5730 # the heatmap as a .png image into the working directory
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5731 export = FALSE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5732 # additional arguments to gplots::heatmap.2, such as:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5733 # - main: main title of plot
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5734 # - xlab: x-axis label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5735 # - ylab: y-axis label
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5736 xlab = "Contrast",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5737 ylab = "Kinase",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5738 # print which kinases:
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5739 # - 1 : all kinases
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5740 # - 2 : significant kinases
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5741 # - 3 : non-significant kinases
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5742 which_kinases = which_kinases,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5743 margins = c(7, 15)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5744 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5745 if (!is.null(plotted_kinases)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5746 cat("\\begin{center}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5747 if (which_kinases != const_ksea_nonastrsk_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5748 cat("Asterisks reflect significance.\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5749 cat("\\end{center}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5750 }
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5751 } # end for (i in ...
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5752 } # end if (length ...
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5753 ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5754
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5755 ```{r kseabar_calc, echo = FALSE, fig.dim = c(9.5, 6), results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5756 ksea_prints <- list()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5757 ksea_barplots <- list()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5758 for (i_cntrst in seq_len(length(rslt$score_list))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5759 next_index <- i_cntrst
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5760 cntrst_a_level <- contrast_metadata_df[i_cntrst, "a_level"]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5761 cntrst_b_level <- contrast_metadata_df[i_cntrst, "b_level"]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5762 cntrst_fold_change <- contrast_metadata_df[i_cntrst, 6]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5763 contrast_label <- sprintf("%s -> %s", cntrst_b_level, cntrst_a_level)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5764 contrast_longlabel <- (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5765 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5766 "Class %s -> Class %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5767 contrast_metadata_df[i_cntrst, "b_level"],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5768 contrast_metadata_df[i_cntrst, "a_level"]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5769 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5770 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5771 main_title <- (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5772 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5773 "Change from treatment %s to treatment %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5774 contrast_metadata_df[i_cntrst, "b_level"],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5775 contrast_metadata_df[i_cntrst, "a_level"]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5776 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5777 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5778 sub_title <- contrast_longlabel
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5779 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5780 expr = {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5781 ksea_scores_rslt <- rslt$score_list[[next_index]]
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5782 if (print_nb_messages) nbe(see_variable(ksea_scores_rslt))
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5783
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5784 if (0 < sum(!is.nan(ksea_scores_rslt$FDR))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5785 sink(deferred <- file())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5786 ksea_low_fdr_print(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5787 rslt = rslt,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5788 i_cntrst = i_cntrst,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5789 i = next_index,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5790 a_level = cntrst_a_level,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5791 b_level = cntrst_b_level,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5792 fold_change = cntrst_fold_change,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5793 caption = contrast_longlabel,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5794 write_db = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5795 anchor = const_table_anchor_t
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5796 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5797 cat("\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5798 sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5799 lines <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5800 paste(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5801 readLines(deferred, warn = FALSE),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5802 collapse = "\n"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5803 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5804 close(deferred)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5805 sq_put(ksea_prints, lines)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5806 sink(stderr())
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5807 cat("\n---\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5808 cat_variable(ksea_prints)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5809 barplot_closure <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5810 ksea_low_fdr_barplot_factory(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5811 rslt = rslt,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5812 i_cntrst = i_cntrst,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5813 i = next_index,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5814 a_level = cntrst_a_level,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5815 b_level = cntrst_b_level,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5816 fold_change = cntrst_fold_change,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5817 caption = contrast_longlabel
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5818 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5819 if (rlang::is_closure(barplot_closure))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5820 sq_put(ksea_barplots, barplot_closure)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5821 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5822 sq_put(ksea_barplots, no_op)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5823 str(ksea_barplots)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5824 cat("\n...\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5825 sink()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5826 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5827 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5828 error = function(e) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5829 str(e)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5830 cat_margins()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5831 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5832 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5833 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5834 ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5835
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5836 ```{r phosphoelm_kinase_upid_desc, echo = FALSE, fig.dim = c(12, 13.7), results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5837
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5838 have_kinase_descriptions <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5839 if (!is.null(bzip2df(kinase_uprt_desc_lut, kinase_uprt_desc_lut_bz2)) &&
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5840 !is.null(bzip2df(kinase_name_uprt_lut, kinase_name_uprt_lut_bz2))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5841 ) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5842 rownames(kinase_uprt_desc_lut) <- kinase_uprt_desc_lut$UniProtID
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5843 kinase_name_to_desc_uprt <- function(s) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5844 rslt <- NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5845 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5846 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5847 which_rows <- eval(s == kinase_name_uprt_lut$kinase)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5848 kinase_uprtid <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5849 kinase_name_uprt_lut[which_rows, 2]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5850 # filter for first _HUMAN match if any
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5851 grepl_human <- grepl("_HUMAN$", kinase_uprtid)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5852 if (0 < sum(grepl_human))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5853 kinase_uprtid <- kinase_uprtid[grepl_human]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5854 # filter for first match if any
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5855 if (0 < length(kinase_uprtid)) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5856 kinase_uprtid <- kinase_uprtid[1]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5857 kinase_desc <- kinase_uprt_desc_lut[kinase_uprtid, 2]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5858 if (!is.na(kinase_desc))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5859 rslt <- c(kinase_desc, kinase_uprtid)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5860 else
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5861 rslt <- c(kinase_desc, "")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5862 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5863 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5864 warning = str
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5865 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5866 rslt
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5867 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5868 TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5869 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5870 kinase_name_to_desc_uprt <- function(s) NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5871 FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5872 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5873 ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5874
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5875 ```{r write_params, echo = FALSE, results = 'asis'}
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5876 # perhaps this should be moved into the functions section, eventually ...
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5877 write_params <- function(db) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5878 # write parameters to report
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5879
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5880 # write parameters to SQLite output
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5881
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5882 mqppep_anova_script_param_df <- data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5883 script = "mqppep_anova_script.Rmd",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5884 parameter = names(param_unlist),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5885 value = param_unlist
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5886 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5887 ddl_exec(db, "
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5888 DROP TABLE IF EXISTS script_parameter;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5889 "
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5890 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5891 ddl_exec(db, "
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5892 CREATE TABLE IF NOT EXISTS script_parameter(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5893 script TEXT,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5894 parameter TEXT,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5895 value ANY,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5896 UNIQUE (script, parameter) ON CONFLICT REPLACE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5897 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5898 ;
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5899 "
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5900 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5901 RSQLite::dbWriteTable(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5902 conn = db,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5903 name = "script_parameter",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5904 value = mqppep_anova_script_param_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5905 append = TRUE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5906 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5907
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5908 loaded_packages_df <- sessioninfo::package_info("loaded")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5909 loaded_packages_df[, "library"] <- as.character(loaded_packages_df$library)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5910 loaded_packages_df <- data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5911 package = loaded_packages_df$package,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5912 version = loaded_packages_df$loadedversion,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5913 date = loaded_packages_df$date
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5914 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5915 cat("\\clearpage\n\\section{Input parameter settings}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5916 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5917 x = param_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5918 tabstops = c(1.75),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5919 underscore_whack = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5920 caption = "Input parameters",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5921 verbatim = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5922 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5923 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5924
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5925 if (!have_kinase_descriptions) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5926 write_params(db)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5927 # We are done with output
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5928 RSQLite::dbDisconnect(db)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5929 param_df_exit()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5930 knitr::knit_exit()
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5931 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5932 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5933
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5934 ```{r kseabar, echo = FALSE, fig.dim = c(9.5, 12.3), results = 'asis'}
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5935 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5936 # squash un-actionable cyclomatic_complexity warning
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5937 if (have_kinase_descriptions) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5938 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5939 my_section_header <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5940 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5941 "inases whose KSEA %s < %s\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5942 ksea_cutoff_statistic,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5943 signif(ksea_cutoff_threshold, 2)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5944 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5945
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5946 # Use enriched kinases to find enriched kinase-substrate pairs
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5947 enriched_kinases <- data.frame(kinase = ls(ksea_asterisk_hash))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5948
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5949 enriched_kinase_descs <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5950 Reduce(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5951 f = function(l, r) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5952 lkup <- kinase_name_to_desc_uprt(r)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5953 if (is.null(lkup)) l
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5954 else r2 <- rbind(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5955 l,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5956 data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5957 kinase = r,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5958 uniprot_id = lkup[2],
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5959 description = lkup[1]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5960 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5961 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5962 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5963 x = enriched_kinases$kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5964 init = NULL
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5965 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5966
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5967 if (length(enriched_kinase_descs) > 0 && nrow(enriched_kinase_descs) > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5968 cat("\n\\clearpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5969 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5970 x = enriched_kinase_descs,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5971 tabstops = c(0.9, 1.3),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5972 headings = c("Kinase", "UniProt ID", "Description"),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5973 caption = paste0("Descriptions of k", my_section_header)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5974 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5975 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5976
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5977 if (FALSE) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5978 cat_variable(sqldf::sqldf("SELECT kinase FROM enriched_kinases"))
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5979 cat_variable(sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5980 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5981 FROM pseudo_ksdata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5982 WHERE gene IN (SELECT kinase FROM enriched_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5983 "))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5984 data_frame_table_latex(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5985 x = sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5986 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5987 FROM pseudo_ksdata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5988 WHERE gene IN (SELECT kinase FROM enriched_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5989 "),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5990 justification = "l l l",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5991 centered = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5992 caption = "substrates of enriched kinases",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5993 anchor = c(const_table_anchor_p, const_table_anchor_t),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5994 underscore_whack = TRUE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
5995 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5996 data_frame_table_latex(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
5997 x = sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5998 SELECT
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
5999 gene AS kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6000 ppep,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6001 sub_gene,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6002 '('||group_concat(gene||'-'||sub_gene)||') '||ppep AS label,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6003 fdr_adjusted_anova_p,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6004 quality,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6005 min_group_obs_count
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6006 FROM (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6007 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6008 FROM pseudo_ksdata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6009 WHERE gene IN (SELECT kinase FROM enriched_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6010 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6011 p_value_data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6012 WHERE ppep = phosphopeptide
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6013 GROUP BY kinase, ppep
4
0ab632432798 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 1c1dbc5a9838e5cd45724b6e53246eb80437e1f1
galaxyp
parents: 3
diff changeset
6014 ORDER BY kinase, p_value_data.quality DESC
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6015 "),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6016 justification = "l l l l l l l",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6017 centered = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6018 caption = "labeled substrates of enriched kinases",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6019 anchor = c(const_table_anchor_p, const_table_anchor_t),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6020 underscore_whack = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6021 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6022 }
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6023 all_enriched_substrates <- sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6024 SELECT
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6025 gene AS kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6026 ppep,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6027 sub_gene,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6028 '('||group_concat(gene||'-'||sub_gene)||') '||ppep AS label,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6029 fdr_adjusted_anova_p,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6030 quality,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6031 min_group_obs_count
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6032 FROM (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6033 SELECT DISTINCT gene, sub_gene, SUB_MOD_RSD AS ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6034 FROM pseudo_ksdata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6035 WHERE gene IN (SELECT kinase FROM enriched_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6036 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6037 p_value_data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6038 WHERE ppep = phosphopeptide
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6039 GROUP BY kinase, ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6040 ORDER BY kinase, ppep, p_value_data.quality DESC
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6041 ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6042
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6043 all_enriched_substrates <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6044 all_enriched_substrates[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6045 all_enriched_substrates$quality >= params$minQuality,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6046 ,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6047 drop = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6048 ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6049
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6050 all_enriched_substrates$sub_gene <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6051 sub(" ///.*", "...",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6052 all_enriched_substrates$sub_gene
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6053 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6054
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6055 all_enriched_substrates$label <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6056 with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6057 all_enriched_substrates,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6058 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6059 "(%s-%s) %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6060 kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6061 trunc_subgene(sub_gene),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6062 ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6063 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6064 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6065
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6066 # this global is set to TRUE by cat_enriched_heading immediately below
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6067 g_neednewpage <- FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6068
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6069 # helper used to label per-kinase substrate enrichment figure
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6070 cat_enriched_heading <- function(m, cut_args) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6071 cutoff <- cut_args$cutoff
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6072 kinase <- cut_args$kinase
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6073 if (g_neednewpage) cat("\\newpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6074 g_neednewpage <- TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6075 if (nrow(m) > g_intensity_hm_rows) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6076 cat(subsection_header(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6077 sprintf(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6078 "Highest-quality %d (of %d) enriched %s-sites",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6079 g_intensity_hm_rows,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6080 nrow(m),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6081 kinase
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6082 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6083 ))
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6084 } else {
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6085 if (nrow(m) == 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6086 return(FALSE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6087 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6088 nrow_m <- nrow(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6089 cat(subsection_header(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6090 sprintf(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6091 "%d enriched %s-site%s",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6092 nrow_m,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6093 kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6094 if (nrow_m > 1) "s" else ""
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6095 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6096 ))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6097 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6098 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6099 cat("\n\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6100 cat("\n\n\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6101 return(TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6102 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6103
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6104 # --------------------------------
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6105 # hack begin - show all substrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6106 enriched_substrates <- all_enriched_substrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6107 # add "FALSE &&" to prevent listing of substrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6108 if (show_enriched_substrates && nrow(enriched_substrates) > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6109 short_row_names <- sub(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6110 "$FAILED_MATCH_GENE_NAME",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6111 "not_found",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6112 enriched_substrates$sub_gene,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6113 fixed = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6114 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6115
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6116 if (print_nb_messages) nbe(see_variable(enriched_substrates))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6117 substrates_df <- with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6118 enriched_substrates,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6119 data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6120 kinase = kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6121 substrate = sub(" ///*", "...", short_row_names),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6122 anova_p_value = signif(fdr_adjusted_anova_p, 2),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6123 min_group_obs_count = signif(min_group_obs_count, 0),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6124 quality = signif(quality, 3),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6125 sequence = trunc_n(30)(ppep)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6126 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6127 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6128
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6129 substrates_df <- substrates_df[
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6130 with(substrates_df, order(kinase, -quality)),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6131 ,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6132 drop = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6133 ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6134
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6135 if (print_nb_messages) nbe(see_variable(substrates_df))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6136 if (nrow(substrates_df) < 1)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6137 substrates_df$sequence <- c()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6138 if (print_nb_messages) nbe(see_variable(substrates_df))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6139 names(substrates_df) <- headers_2nd_line <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6140 c("Kinase", "Substrate", "p-value", "per group)", "quality", "Sequence")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6141 headers_1st_line <- c("", "", "ANOVA", "min(values", "", "")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6142 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6143 x = substrates_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6144 tabstops = c(1.2, 0.8, 0.5, 0.65, 0.5),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6145 headings = c(headers_1st_line, headers_2nd_line),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6146 caption = "Details for all enriched substrates of enriched kinases"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6147 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6148 rm(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6149 enriched_substrates,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6150 substrates_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6151 short_row_names,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6152 headers_1st_line,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6153 headers_2nd_line
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6154 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6155 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6156 cat("\\clearpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6157 # hack end - show all substrates
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6158 # --------------------------------
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6159
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6160 # print deferred tables and graphs for kinases from contrasts
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6161 for (i_cntrst in seq_len(length(ksea_prints))) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6162 #latex_samepage({
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6163 cat(ksea_prints[[i_cntrst]])
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6164 cat("\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6165 ksea_barplots[[i_cntrst]]()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6166 cat("\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6167 cat("\\clearpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6168 #})
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6169 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6170
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6171 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6172 ```
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6173
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6174 ```{r enriched, echo = FALSE, fig.dim = c(12, 13.7), results = 'asis'}
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6175 # nolint start
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6176 # squash un-actionable cyclomatic_complexity warning
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6177 if (g_can_run_ksea) {
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6178 # nolint end
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6179 g_did_enriched_header <- FALSE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6180 for (kinase_name in sort(enriched_kinases$kinase)) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6181 enriched_substrates <-
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6182 all_enriched_substrates[
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6183 all_enriched_substrates$kinase == kinase_name,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6184 ,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6185 drop = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6186 ]
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6187 ten_trunc_ppep <- trunc_enriched_substrate(enriched_substrates$ppep)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6188 enriched_substrates$label <- with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6189 enriched_substrates,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6190 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6191 "(%s) %s",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6192 make.names(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6193 sub("$FAILED_MATCH_GENE_NAME", "not_found", sub_gene, fixed = TRUE),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6194 unique = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6195 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6196 ten_trunc_ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6197 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6198 )
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6199 # Get the intensity values for the heatmap
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6200 enriched_intensities <-
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6201 as.matrix(unimputed_quant_data_log[
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6202 enriched_substrates$ppep, , drop = FALSE
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6203 ])
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6204
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6205 # Remove rows having too many NA values to be relevant
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6206 good_rows <- (rowSums(enriched_intensities, na.rm = TRUE) != 0)
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6207
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6208 enriched_substrates <- enriched_substrates[good_rows, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6209 enriched_intensities <- enriched_intensities[good_rows, , drop = FALSE]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6210
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6211 # Rename the rows with the display-name for the heatmap
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6212 short_row_names <- sub(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6213 "$FAILED_MATCH_GENE_NAME",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6214 "not_found",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6215 enriched_substrates$sub_gene,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6216 fixed = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6217 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6218 short_row_names <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6219 make.names(short_row_names, unique = TRUE)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6220 long_row_names <-
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6221 sapply(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6222 X = rownames(enriched_intensities),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6223 FUN = function(rn) {
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6224 enriched_substrates[enriched_substrates$ppep == rn, "label"]
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6225 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6226 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6227 rownames(enriched_intensities) <- long_row_names
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6228 # Format as matrix for heatmap
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6229 m <- as.matrix(enriched_intensities)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6230 rownames(m) <- trunc_enriched_substrate(rownames(m))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6231
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6232 # Draw the heading and heatmap
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6233 nrow_m <- nrow(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6234 if (nrow_m > 0) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6235 if (!g_did_enriched_header) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6236 cat("\n\\clearpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6237 cat(section_header(paste0("K", my_section_header)))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6238 g_did_enriched_header <- TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6239 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6240 is_na_m <- is.na(m)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6241 cellnote_m <- is_na_m
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6242 cellnote_m[!is_na_m] <- ""
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6243 cellnote_m[is_na_m] <- params$heatMapNAcellNote
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6244 cut_args <- new_env()
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6245 cut_args$cutoff <- cutoff
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6246 cut_args$kinase <- kinase_name
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6247 cut_args$statistic <- ksea_cutoff_statistic
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6248 cut_args$threshold <- ksea_cutoff_threshold
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6249 number_of_peptides_found <-
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6250 ppep_heatmap(
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6251 m = m,
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6252 cellnote = cellnote_m,
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6253 cutoff = cut_args,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6254 hm_heading_function = cat_enriched_heading,
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6255 hm_main_title = paste(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6256 "Unnormalized (zero-imputed)",
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6257 "intensities of enriched kinase-substrates"),
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6258 suppress_row_dendrogram = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6259 master_cex = 0.35,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6260 sepcolor = "black",
2
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
6261 colsep = sample_colsep,
1023fa7bd75f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 423304b26e63d23cd8e5fb4c2fb729c5beea1254
galaxyp
parents: 1
diff changeset
6262 row_scaling = "none"
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6263 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6264 if (number_of_peptides_found > 1) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6265
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6266 tryCatch(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6267 {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6268 rownames(m) <- short_row_names
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6269 cov_heatmap(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6270 m = m,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6271 kinase_name = kinase_name,
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6272 top_substrates = nrow_m > g_intensity_hm_rows
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6273 )
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6274 },
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6275 error = function(e) {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6276 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6277 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6278 "ERROR: %s\n\\newline\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6279 mget("e")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6280 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6281 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6282 cat(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6283 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6284 "message: %s\n\\newline\n",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6285 e$message
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6286 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6287 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6288 cat_margins()
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6289 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6290 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6291 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6292 substrates_df <- with(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6293 enriched_substrates,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6294 data.frame(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6295 substrate = sub(" ///*", "...", short_row_names),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6296 sequence = trunc_long_ppep(ppep),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6297 anova_p_value = signif(fdr_adjusted_anova_p, 2),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6298 min_group_obs_count = signif(min_group_obs_count, 0),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6299 quality = signif(quality, 3)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6300 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6301 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6302 excess_substrates <- nrow(substrates_df) > g_intensity_hm_rows
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6303 if (excess_substrates)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6304 substrates_df <- substrates_df[1:g_intensity_hm_rows, ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6305 names(substrates_df) <- headers_2nd_line <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6306 c("Substrate", "Sequence", "p-value", "per group)", "quality")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6307 headers_1st_line <- c("", "", "ANOVA", "min(values", "")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6308 if (1 < nrow(enriched_substrates))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6309 cat("\n\\newpage\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6310 cat(subsubsection_header(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6311 sprintf(
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6312 "Details for %s%s-sites",
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6313 if (excess_substrates)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6314 sprintf(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6315 "%s \"highest quality\" ",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6316 g_intensity_hm_rows
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6317 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6318 else "",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6319 kinase_name
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6320 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6321 ))
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6322 substrates_df <- substrates_df[order(-substrates_df$quality), ]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6323 data_frame_tabbing_latex(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6324 x = substrates_df,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6325 tabstops = c(0.8, 3.8, 0.6, 0.8),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6326 headings = c(headers_1st_line, headers_2nd_line)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6327 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6328 } else {
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6329 if (print_nb_messages) nbe(see_variable(nrow_m > 0), "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6330 }
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6331 if (print_nb_messages) nb("end kinase ", kinase_name, "\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6332 }
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6333
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6334 # Write output tabular files
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6335
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6336 # get kinase, ppep, concat(kinase) tuples for enriched kinases
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6337
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6338 if (print_nb_messages) nb("kinase_ppep_label <- ...\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6339 if (print_nb_messages) nbe("kinase_ppep_label <- ...\n")
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6340 kinase_ppep_label <- sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6341 WITH
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6342 t(ppep, label) AS
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6343 (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6344 SELECT DISTINCT
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6345 SUB_MOD_RSD AS ppep,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6346 group_concat(gene, '; ') AS label
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6347 FROM pseudo_ksdata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6348 WHERE GENE IN (SELECT kinase FROM enriched_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6349 GROUP BY ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6350 ),
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6351 k(kinase, ppep_join) AS
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6352 (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6353 SELECT DISTINCT gene AS kinase, SUB_MOD_RSD AS ppep_join
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6354 FROM pseudo_ksdata
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6355 WHERE GENE IN (SELECT kinase FROM enriched_kinases)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6356 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6357 SELECT k.kinase, t.ppep, t.label
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6358 FROM t, k
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6359 WHERE t.ppep = k.ppep_join
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6360 ORDER BY k.kinase, t.ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6361 ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6362
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6363
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6364 # extract what we need from full_data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6365 impish <- cbind(rownames(quant_data_imp), quant_data_imp)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6366 colnames(impish)[1] <- "Phosphopeptide"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6367 data_table_imputed_sql <- "
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6368 SELECT
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6369 f.*,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6370 k.label AS KSEA_enrichments,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6371 q.*
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6372 FROM
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6373 metadata_plus_p f
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6374 LEFT JOIN kinase_ppep_label k
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6375 ON f.Phosphopeptide = k.ppep,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6376 impish q
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6377 WHERE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6378 f.Phosphopeptide = q.Phosphopeptide
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6379 "
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6380 data_table_imputed <- sqldf::sqldf(data_table_imputed_sql)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6381 # Zap the duplicated 'Phosphopeptide' column named 'ppep'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6382 data_table_imputed <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6383 data_table_imputed[, c(1:12, 14:ncol(data_table_imputed))]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6384
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6385 # Output imputed, un-normalized data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6386 if (print_nb_messages) nb("Output imputed, un-normalized data tabular file\n")
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6387 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6388 "Output imputed, un-normalized data tabular file\n")
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6389 write.table(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6390 data_table_imputed
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6391 , file = imputed_data_filename
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6392 , sep = "\t"
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6393 , col.names = TRUE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6394 , row.names = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6395 , quote = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6396 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6397
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6398
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6399 #output quantile normalized data
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6400 impish <- cbind(rownames(quant_data_imp_qn_log), quant_data_imp_qn_log)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6401 colnames(impish)[1] <- "Phosphopeptide"
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6402 data_table_imputed <- sqldf::sqldf(data_table_imputed_sql)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6403 # Zap the duplicated 'Phosphopeptide' column named 'ppep'
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6404 data_table_imputed <-
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6405 data_table_imputed[, c(1:12, 14:ncol(data_table_imputed))]
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6406 if (print_nb_messages) nb("Output quantile normalized data tabular file\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6407 if (print_nb_messages) nbe("Output quantile normalized data tabular file\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6408 write.table(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6409 data_table_imputed,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6410 file = imp_qn_lt_data_filenm,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6411 sep = "\t",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6412 col.names = TRUE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6413 row.names = FALSE,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6414 quote = FALSE
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6415 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6416
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6417 ppep_kinase <- sqldf::sqldf("
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6418 SELECT DISTINCT k.ppep, k.kinase
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6419 FROM (
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6420 SELECT DISTINCT gene AS kinase, SUB_MOD_RSD AS ppep
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6421 FROM pseudo_ksdata
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6422 WHERE GENE IN (SELECT kinase FROM enriched_kinases)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6423 ) k
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6424 ORDER BY k.ppep, k.kinase
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6425 ")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6426
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6427 RSQLite::dbWriteTable(
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6428 conn = db,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6429 name = "ksea_enriched_ks",
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6430 value = ppep_kinase,
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6431 append = FALSE
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6432 )
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6433 }
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6434
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6435 if (print_nb_messages) nb("RSQLite::dbWriteTable anova_signif\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6436
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6437 RSQLite::dbWriteTable(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6438 conn = db,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6439 name = "anova_signif",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6440 value = p_value_data,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6441 append = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6442 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6443
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6444 ddl_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6445 DROP VIEW IF EXISTS stats_metadata_v;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6446 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6447 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6448 dml_no_rows_exec(db, "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6449 CREATE VIEW stats_metadata_v
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6450 AS
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6451 SELECT DISTINCT m.*,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6452 p.raw_anova_p,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6453 p.fdr_adjusted_anova_p,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6454 kek.kinase AS ksea_enrichments
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6455 FROM
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6456 mrgfltr_metadata_view m
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6457 LEFT JOIN anova_signif p
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6458 ON m.phospho_peptide = p.phosphopeptide
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6459 LEFT JOIN ksea_enriched_ks kek
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6460 ON m.phospho_peptide = kek.ppep
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6461 ;
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6462 "
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6463 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6464
3
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6465 if (print_nb_messages) nb(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6466 "Output contents of `stats_metadata_v` table to tabular file\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6467 if (print_nb_messages) nbe(
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6468 "Output contents of `stats_metadata_v` table to tabular file\n")
6f51e262d84d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3dcf0d08f006b888061ff83eadc65e550d751869
galaxyp
parents: 2
diff changeset
6469
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6470 write.table(
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6471 dbReadTable(db, "stats_metadata_v"),
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6472 file = anova_ksea_mtdt_file,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6473 sep = "\t",
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6474 col.names = TRUE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6475 row.names = FALSE,
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6476 quote = FALSE
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6477 )
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6478
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6479 cat("\n\\clearpage\n")
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6480
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6481 ```
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6482
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6483 # Data-processing summary flowchart
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6484
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6485 ![Flowchart showing ANOVA and KSEA data-processing steps](KSEA_impl_flowchart.pdf)
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6486
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6487 ```{r parmlist, echo = FALSE, fig.dim = c(9, 10), results = 'asis'}
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6488 cat("\\leavevmode\n\n\n")
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6489
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6490 write_params(db)
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6491 # We are done with output
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6492 RSQLite::dbDisconnect(db)
1
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6493
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6494 cat("\\clearpage\n\\section{R package versions}\n")
2276e88d5a1f planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 43e7a43b545c24b2dc33d039198551c032aa79be
galaxyp
parents: 0
diff changeset
6495 utils::toLatex(utils::sessionInfo())
0
d9b68bedbc91 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/mqppep commit 3a7b3609d6e514c9e8f980ecb684960c6b2252fe
galaxyp
parents:
diff changeset
6496 ```