Mercurial > repos > dlalgroup > pmids_to_pubtator_matrix
annotate simtext_app.R @ 2:ada4c7b3fc39 draft default tip
"planemo upload for repository https://github.com/dlal-group/simtext commit 63f67ee02be2eb4323a5ba5dcdd33d1fd0b7c24e"
author | dlalgroup |
---|---|
date | Thu, 08 Oct 2020 05:39:58 +0000 |
parents | 3f4adc85ba5d |
children |
rev | line source |
---|---|
0
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
2 ### SimText App ### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
3 # |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
4 # The tool enables the exploration of data generated by text_to_wordmatrix or pmids_to_pubtator_matrix in a locally run ShinyApp. Features are word clouds for each initial search query, dimension reduction and hierarchical clustering of the binary matrix, and a table with words and their frequency among the search queries. |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
5 # |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
6 # Input: |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
7 # |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
8 # 1) Input 1: |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
9 # Tab-delimited table with |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
10 # - column with search queries starting with "ID_", e.g. "ID_gene" if initial search queries were genes |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
11 # - column(s) with grouping factor(s) to compare pre-existing categories of the initial search queries with the grouping based on text. The column names should start with "GROUPING_". If the column name is "GROUPING_disorder", "disorder" will be shown as a grouping variable in the app. |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
12 # 2) Input 2: |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
13 # Output of text_to_wordmatrix or pmids_to_pubtator_matrix, or binary matrix. |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
14 # |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
15 # optional arguments: |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
16 # -h, --help show help message |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
17 # -i INPUT, --input INPUT input file name. add path if file is not in working directory |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
18 # -m MATRIX, --matrix MATRIX matrix file name. add path if file is not in working directory |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
19 # -p PORT, --port PORT specify port, otherwise randomly selected |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
20 # |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
21 #Output: |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
22 #Shiny app with word clouds, dimensionality reduction plot, dendrogram of hierarchical clustering and table with words and their frequency among the entities. |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
23 # |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
24 #Packages |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
25 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
26 if ( '--install_packages' %in% commandArgs()) { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
27 print('Installing packages') |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
28 if (!require('shiny')) install.packages('shiny', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
29 if (!require('plotly')) install.packages('plotly', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
30 if (!require('DT')) install.packages('DT', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
31 if (!require('shinycssloaders')) install.packages('shinycssloaders', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
32 if (!require('shinythemes')) install.packages('shinythemes', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
33 if (!require('tableHTML')) install.packages('tableHTML', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
34 if (!require('argparse')) install.packages('argparse', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
35 if (!require('PubMedWordcloud')) install.packages('PubMedWordcloud', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
36 if (!require('ggplot2')) install.packages('ggplot2', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
37 if (!require('stringr')) install.packages('stringr', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
38 if (!require('tidyr')) install.packages('tidyr', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
39 if (!require('magrittr')) install.packages('magrittr', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
40 if (!require('plyr')) install.packages('plyr', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
41 if (!require('ggpubr')) install.packages('ggpubr', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
42 if (!require('rafalib')) install.packages('rafalib', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
43 if (!require('RColorBrewer')) install.packages('RColorBrewer', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
44 if (!require('dendextend')) install.packages('dendextend', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
45 if (!require('Rtsne')) install.packages('Rtsne', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
46 if (!require('umap')) install.packages('umap', repo="http://cran.rstudio.com/"); |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
47 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
48 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
49 suppressPackageStartupMessages(library("shiny")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
50 suppressPackageStartupMessages(library("plotly")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
51 suppressPackageStartupMessages(library("DT")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
52 suppressPackageStartupMessages(library("shinycssloaders")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
53 suppressPackageStartupMessages(library("shinythemes")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
54 suppressPackageStartupMessages(library("tableHTML")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
55 suppressPackageStartupMessages(library("argparse")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
56 suppressPackageStartupMessages(library("PubMedWordcloud")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
57 suppressPackageStartupMessages(library("ggplot2")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
58 suppressPackageStartupMessages(library("stringr")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
59 suppressPackageStartupMessages(library("tidyr")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
60 suppressPackageStartupMessages(library("magrittr")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
61 suppressPackageStartupMessages(library("plyr")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
62 suppressPackageStartupMessages(library("ggpubr")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
63 suppressPackageStartupMessages(library("rafalib")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
64 suppressPackageStartupMessages(library("RColorBrewer")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
65 suppressPackageStartupMessages(library("dendextend")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
66 suppressPackageStartupMessages(library("Rtsne")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
67 suppressPackageStartupMessages(library("umap")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
68 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
69 #command arguments |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
70 parser <- ArgumentParser() |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
71 parser$add_argument("-i", "--input", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
72 help = "input file name. add path if file is not in working directory") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
73 parser$add_argument("-m", "--matrix", default= NULL, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
74 help = "matrix file name. add path if file is not in working directory") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
75 parser$add_argument("--host", default=NULL, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
76 help="Specify host") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
77 parser$add_argument("-p", "--port", type="integer", default=NULL, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
78 help="Specify port, otherwise randomly select") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
79 parser$add_argument("--install_packages", action="store_true", default=FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
80 help="If you want to auto install missing required packages.") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
81 args <- parser$parse_args() |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
82 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
83 # Set host |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
84 if(!is.null(args$host)){ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
85 options(shiny.host = args$host) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
86 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
87 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
88 # Set port |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
89 if(!is.null(args$port)){ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
90 options(shiny.port = args$port) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
91 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
92 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
93 #load data |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
94 data = read.delim(args$input, stringsAsFactors=FALSE) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
95 index_grouping = grep("GROUPING_", names(data)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
96 names(data)[index_grouping] = sub(".*_", "",names(data)[index_grouping]) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
97 colindex_id = grep("^ID_", names(data)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
98 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
99 matrix = read.delim(args$matrix, check.names = FALSE, header = TRUE, sep='\t') |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
100 matrix = (as.matrix(matrix)>0) *1 #transform matrix to binary matrix |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
101 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
102 ##### UI ###### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
103 ui <- shinyUI(fluidPage( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
104 navbarPage(theme = shinytheme("flatly"), id = "inTabset",selected = "panel1", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
105 title = "SimText", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
106 tabPanel("Home", value = "panel1", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
107 tabPanel("Results", value = "panel1", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
108 fluidRow(width=12, offset=0, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
109 column(width = 4, style = "padding-right: 0px", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
110 wellPanel(h5(strong("ID of interest")), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
111 style = "background-color:white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
112 border-bottom: 2px solid #EEEEEE; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
113 border-top-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
114 border-right-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
115 border-left-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
116 box-shadow: 0px 0px 0px white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
117 padding:3px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
118 width: 100%"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
119 selectInput('ID', 'Select ID:', paste0(data[[colindex_id]]," (",seq(1,length(data[[colindex_id]])),")"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
120 column(width = 3, style = "padding-right: 0px", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
121 wellPanel(h5(strong("Color settings")), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
122 style = "background-color:white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
123 border-bottom: 2px solid #EEEEEE; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
124 border-top-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
125 border-right-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
126 border-left-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
127 box-shadow: 0px 0px 0px white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
128 padding:3px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
129 width: 100%"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
130 radioButtons('colour', 'Color by:', c("Grouping variable", "Individual word")), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
131 selectInput("colour_select", "Select:", choices=c(names(data)[index_grouping]))) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
132 ), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
133 fluidRow(width = 12, offset = 0, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
134 column(width = 4, #style = "height:650px;", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
135 wellPanel(textOutput("ID"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
136 style = "background-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
137 color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
138 border-top-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
139 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
140 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
141 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
142 margin-bottom: 0px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
143 padding:5px"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
144 wellPanel( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
145 fluidRow( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
146 column(width = 4, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
147 numericInput('fontsize', 'Font size:',value = 7, min=1, max=50)), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
148 column(width = 4, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
149 numericInput('nword', 'Word number:',value = 50, min=1, max=100)), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
150 column(width = 12, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
151 withSpinner(plotOutput("WordcloudPlot",height= "325px"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
152 column(width = 12, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
153 downloadLink("downloadWordcloud", "Download"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
154 style = "background-color: #ffffff; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
155 border-bottom-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
156 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
157 height: 470px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
158 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
159 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
160 margin-top: 0px"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
161 wellPanel(textOutput("Table"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
162 style = "background-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
163 color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
164 border-top-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
165 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
166 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
167 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
168 margin-bottom: 0px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
169 padding:5px"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
170 wellPanel(withSpinner(DT::dataTableOutput("datatable", height= "150px")), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
171 style = "background-color: #ffffff; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
172 border-bottom-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
173 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
174 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
175 height: 175px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
176 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
177 margin-top: 0px") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
178 ), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
179 column(width = 8, #style='padding:0px;', |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
180 wellPanel("T-SNE plot of wordmatrix", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
181 style = "background-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
182 color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
183 border-top-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
184 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
185 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
186 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
187 margin-bottom: 0px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
188 padding:5px"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
189 wellPanel( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
190 fluidRow( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
191 column(width = 2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
192 radioButtons('method', 'Method:',choices=c("t-SNE","UMAP"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
193 column(width = 2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
194 numericInput('perplexity', 'Perplexity:',value = 2, min=1, max=nrow(data)-1)), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
195 column(width = 2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
196 radioButtons('label', 'Labels:',choices=c("Index","IDs"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
197 column(width = 2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
198 numericInput('labelsize', 'Label size:',value = 12, min=1, max=30)), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
199 column(width = 8, style='padding:0px;', |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
200 withSpinner(plotlyOutput("TsnePlot",height=550))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
201 column(width = 4, style='padding:0px;', |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
202 withSpinner(plotOutput("TsnePlot_legend",height=550))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
203 column(width=2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
204 downloadLink("downloadPlotdata",label = "Download data"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
205 style = "background-color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
206 border-bottom-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
207 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
208 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
209 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
210 margin-top: 0px" |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
211 #height=575px |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
212 ))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
213 fluidRow(column(width = 12, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
214 wellPanel("Hierarchical clustering of wordmatrix", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
215 style = "background-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
216 color: white; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
217 border-top-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
218 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
219 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
220 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
221 margin-bottom: 0px; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
222 padding:5px") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
223 , |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
224 wellPanel( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
225 fluidRow( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
226 column(width = 2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
227 radioButtons('hcmethod', 'Method:',choices=c("ward.D2","average","complete","single"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
228 column(width = 2, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
229 numericInput('labelsize_hc', 'Label size:', value = 8, min=1, max=30)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
230 ), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
231 fluidRow( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
232 column(width = 9, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
233 withSpinner(plotOutput("hclust"))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
234 column(width = 3, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
235 withSpinner(plotOutput("hclust_legend"))) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
236 ), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
237 style = "background-color: #ffffff; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
238 border-bottom-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
239 border-left-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
240 border-right-color: #333333; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
241 box-shadow: 3px 3px 3px #d8d8d8; |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
242 margin-top: 0px") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
243 , |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
244 verbatimTextOutput("test") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
245 )) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
246 )) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
247 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
248 # , |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
249 #tabPanel("About", value = "panel2", h3("")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
250 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
251 ))) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
252 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
253 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
254 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
255 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
256 ###### SERVER ###### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
257 server <- function(input, output, session) { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
258 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
259 ##### Global ##### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
260 IDs = reactive(paste0(data[[colindex_id]]," (",seq(1,length(data[[colindex_id]])),")")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
261 index_ID = reactive({which(IDs() == input$ID)}) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
262 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
263 ##### Wordcloud plot and download ###### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
264 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
265 output$ID <- renderText({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
266 paste("Wordcloud of",data[[colindex_id]][index_ID()]) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
267 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
268 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
269 output$WordcloudPlot <- renderPlot({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
270 ID_matrix = matrix[index_ID(),] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
271 ID_matrix = data.frame(word= as.character(names(ID_matrix)), freq= ID_matrix) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
272 colnames(ID_matrix) = c("word", "freq") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
273 ID_matrix = ID_matrix[ID_matrix$freq == 1,] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
274 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
275 plotWordCloud(ID_matrix, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
276 max.words = min(nrow(ID_matrix),input$nword), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
277 scale= c(input$fontsize/10, input$fontsize/10), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
278 colors= brewer.pal(8,"Greys")[4:8]) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
279 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
280 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
281 output$downloadWordcloud <- downloadHandler( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
282 filename = function() { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
283 paste0(paste0("Wordcloudof",data[[colindex_id]][index_ID()]),".pdf", sep="") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
284 }, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
285 content = function(file) { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
286 ID_matrix = matrix[index_ID(),] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
287 ID_matrix = data.frame(word= names(ID_matrix), freq= ID_matrix) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
288 colnames(ID_matrix) = c("word", "freq") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
289 ID_matrix = ID_matrix[ID_matrix$freq == 1,] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
290 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
291 pdf(file) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
292 plotWordCloud(ID_matrix, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
293 max.words = min(max(nrow(ID_matrix)),input$nword), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
294 scale= c(input$fontsize/10, input$fontsize/10), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
295 colors= brewer.pal(8,"Greys")[4:8]) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
296 dev.off() |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
297 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
298 ) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
299 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
300 ##### Table ##### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
301 output$Table <- renderText({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
302 paste("Most occuring words among IDs") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
303 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
304 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
305 output$datatable <- DT::renderDataTable({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
306 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
307 colsum_data= data.frame(word=colnames(matrix), freq=colSums(matrix)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
308 colsum_data = colsum_data[order(colsum_data$freq, decreasing = T),] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
309 colnames(colsum_data) = c("Word", paste0("IDs (total n=", nrow(matrix),")")) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
310 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
311 DT::datatable(colsum_data, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
312 extensions = c("Buttons"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
313 rownames = F, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
314 fillContainer = T, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
315 escape=FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
316 options = list(dom = "t", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
317 scrollY = min(nrow(colsum_data),500), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
318 scrollX= TRUE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
319 scroller = TRUE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
320 autoWidth = TRUE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
321 pageLength = nrow(colsum_data), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
322 columnDefs = list(list(className = 'dt-center', targets = "_all"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
323 list(width = '50%', targets = "_all"))) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
324 ) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
325 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
326 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
327 ##### Colour/Grouping ##### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
328 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
329 outVar <- reactive({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
330 if(input$colour == "Grouping variable"){ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
331 return(names(data)[index_grouping]) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
332 } else { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
333 return(colnames(matrix)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
334 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
335 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
336 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
337 observe({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
338 updateSelectInput(session, "colour_select", choices = outVar())}) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
339 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
340 colour_choice = reactive({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
341 if(input$colour == "Grouping variable"){ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
342 return(as.factor(data[,input$colour_select])) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
343 } else { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
344 matrix = as.data.frame(matrix) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
345 colour_byword = matrix[[input$colour_select]] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
346 colour_byword = ifelse(colour_byword > 0,"Selected word associated with ID","Selected word not associated with ID") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
347 return(as.factor(colour_byword)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
348 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
349 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
350 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
351 color_palette = reactive({palette=c("#A6CEE3", "#1F78B4", "#B2DF8A", "#33A02C", "#FB9A99", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
352 "#E31A1C", "#FDBF6F", "#FF7F00", "#CAB2D6", "#6A3D9A", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
353 "#00AFBB", "#E7B800", "#FC4E07", "#999999", "#E69F00", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
354 "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
355 return( palette[1:length(levels(colour_choice()))] ) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
356 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
357 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
358 ##### Dimension reduction plot and download ##### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
359 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
360 data.dimred = reactive({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
361 if (input$method == "t-SNE"){ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
362 tsne_result <- Rtsne(matrix, perplexity = input$perplexity, check_duplicates=F) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
363 data["X_Coord"] = tsne_result$Y[,1] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
364 data["Y_Coord"] = tsne_result$Y[,2] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
365 return(data) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
366 } else if (input$method == "UMAP"){ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
367 umap_result = umap(matrix) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
368 data["X_Coord"] = umap_result$layout[,1] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
369 data["Y_Coord"] = umap_result$layout[,2] |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
370 return(data) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
371 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
372 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
373 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
374 output$TsnePlot <- renderPlotly({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
375 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
376 if (input$label == "Index") { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
377 labeling = as.character(seq(1,nrow(data))) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
378 } else if (input$label == "IDs") { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
379 labeling= as.character(data[[colindex_id]]) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
380 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
381 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
382 p = plot_ly(colors = color_palette()) %>% |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
383 add_trace(type="scatter", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
384 mode = 'markers', |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
385 x = data.dimred()$X_Coord[index_ID()], |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
386 y = data.dimred()$Y_Coord[index_ID()], |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
387 opacity=0.15, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
388 marker = list( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
389 color = "grey", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
390 size = 80)) %>% |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
391 add_trace(x=data.dimred()$X_Coord, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
392 y=data.dimred()$Y_Coord, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
393 type="scatter", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
394 mode="text", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
395 text= labeling, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
396 textfont = list(size= input$labelsize), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
397 color = factor(colour_choice())) %>% |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
398 add_trace(x=data.dimred()$X_Coord, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
399 y=data.dimred()$Y_Coord, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
400 type="scatter", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
401 mode="markers", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
402 opacity=0, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
403 text= paste0( "ID: ",data[[colindex_id]], "\n", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
404 "Index: ",seq(1,nrow(data)), "\n", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
405 "Grouping: ", paste(data[,index_grouping])), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
406 hoverinfo = "text", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
407 color = factor(colour_choice())) %>% |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
408 layout(showlegend = FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
409 yaxis= list(title = "", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
410 zeroline = FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
411 linecolor = toRGB("black"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
412 linewidth = 1, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
413 showticklabels = FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
414 showgrid = FALSE), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
415 xaxis = list(title = "", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
416 zeroline = FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
417 linecolor = toRGB("black"), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
418 linewidth = 1, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
419 showticklabels = FALSE, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
420 showgrid = FALSE), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
421 autosize = T) %>% |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
422 config(modeBarButtonsToRemove = c("zoomIn2d", "zoomOut2d", "hoverClosestGeo", "hoverClosestGl2d", "toImage", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
423 "hoverClosestCartesian", "lasso2d", "select2d", "resetScale2d", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
424 "hoverCompareCartesian", "hoverClosestPie", "toggleSpikelines"), displaylogo = FALSE) %>% |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
425 style(hoverinfo = "none", traces = c(1,2)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
426 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
427 p |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
428 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
429 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
430 #legend of plotly plot by ggplot |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
431 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
432 output$TsnePlot_legend <- renderPlot({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
433 p = ggplot(data, aes(x=1, y=1)) + |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
434 geom_text(aes(label=seq(1,nrow(data)), colour=factor(colour_choice())), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
435 size=3.5, fontface = "bold") + |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
436 theme_classic()+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
437 scale_color_manual(values = color_palette())+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
438 theme(legend.title = element_blank())+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
439 theme(legend.position = "right")+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
440 theme(legend.text=element_text(size=9)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
441 leg <- get_legend(p) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
442 as_ggplot(leg) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
443 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
444 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
445 output$downloadPlotdata <- downloadHandler( |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
446 filename = function() { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
447 paste0(input$method,"_coordinates.csv") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
448 }, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
449 content = function(file) { |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
450 write.csv(data.dimred(), file, row.names = F) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
451 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
452 ) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
453 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
454 ##### Hierarchical clustering ####### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
455 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
456 output$hclust <- renderPlot({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
457 set.seed(42) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
458 clustering=hclust(dist(matrix), method=input$hcmethod) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
459 par(oma=c(3,3,3,3)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
460 palette(color_palette()) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
461 par(mar = rep(0, 4)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
462 myplclust(clustering, |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
463 labels=paste(data[[colindex_id]]), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
464 lab.col=as.fumeric(as.character(colour_choice()), levels = sort(unique(as.character(colour_choice())))), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
465 cex=as.numeric(input$labelsize_hc/10), |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
466 main="", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
467 yaxt="n", |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
468 ylab= "") |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
469 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
470 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
471 #legend |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
472 output$hclust_legend <- renderPlot({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
473 p = ggplot(data, aes(x=1, y=1)) + |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
474 geom_text(aes(label=seq(1,nrow(data)), colour=factor(colour_choice())), fontface = "bold") + |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
475 theme_classic()+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
476 scale_color_manual(values = color_palette())+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
477 theme(legend.title = element_blank())+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
478 theme(legend.position = "right")+ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
479 theme(legend.text=element_text(size=9)) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
480 leg <- get_legend(p) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
481 as_ggplot(leg) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
482 }) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
483 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
484 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
485 ##### Test field for development ###### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
486 #output$test <- renderPrint({ |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
487 #}) |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
488 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
489 } |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
490 |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
491 ###### APP ###### |
3f4adc85ba5d
"planemo upload for repository https://github.com/dlal-group/simtext commit fd3f5b7b0506fbc460f2a281f694cb57f1c90a3c-dirty"
dlalgroup
parents:
diff
changeset
|
492 shinyApp(ui, server) |