-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
1610 lines (1548 loc) · 108 KB
/
app.R
File metadata and controls
1610 lines (1548 loc) · 108 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#shinyMIPs
#based on MIPgen by Evan Boyle
library(shiny)
library(shinythemes)
library(shinyjs)
library(colourpicker)
library(shinyBS)
library(shinyWidgets)
library(Biostrings)
library(wordcloud)
library(wordcloud2)
#set working directory
setwd("/home/MIPgen")
source("helpers.R")
# ui ----------------------------------------------------------------------
#start of ui
ui <- tagList(tags$style(type = "text/css", "
.irs-bar {
border-top-color: #2FA4E7;
border-bottom-color: #2FA4E7;
}
.irs-bar-edge {
border-color: #2FA4E7;
}
.irs-from, .irs-to, .irs-bar-edge, .irs-bar {
background: #2FA4E7;
}
.irs-single, .irs-to, .irs-bar-edge, .irs-bar {
background: #2FA4E7;
}
"), #close tags$style
navbarPage(title = div(icon("diamond"), "shinyMIPs"),
windowTitle = "shinyMIPs",
#starting active tab
selected = div(icon("star")," Preamble"),
fluid = TRUE,
theme = shinytheme("cerulean"),
#inverse --> as the name suggests, comment-out if desired
#inverse = TRUE,
useShinyjs(),
tabPanel(div(icon("star"), " Preamble"),
fluidRow(
column(5, align = "left",
titlePanel("Preamble"),
tags$br(),
tags$h4("Welcome to shinyMIPs, a user interface to generate MIPs with MIPgen."),
tags$h4("This program is using hg19."),
tags$h4("Please note: overwriting of files is enabled at all times. I advise caution."),
tags$h4("I will regularly remove old user files, so make sure to download everything you need."),
imageOutput("wordcloud",
width = "120%",
height = "440px"),
#tags$hr(),
tags$h6("P.S. When talking about MIPs, what is actually meant are smMIPs."),
tags$br(),
bookmarkButton(label = "Bookmark",
class = "btn-primary",
title = "Save shinyMIPs' state to a URL to resume your work at a later time (work in progress).")
) #close column
) #close fluidrow
), #close tabpanel
tabPanel(div(icon("folder-open"),
" Project title"),
titlePanel("Project title"),
tags$br(),
textInput("prefix", "Enter your (preferably unique) project name here (snake_case!)",
width = "350px",
placeholder = "AB_gene_XYZalpha"),
bsTooltip("prefix", "This will be used for naming your files")#,
), #close tabpanel
tabPanel(div(icon("hourglass-1"), " What to cover"),
tabsetPanel(id="gene_or_region",
tabPanel("Gene",
titlePanel("Choose genes to be covered"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
withBusyIndicatorUI(
actionButton("genes",
"Create gene list",
icon("hourglass-start"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("genes", "This creates a list of your genes on the server"),
tags$hr(),
withBusyIndicatorUI(
actionButton("exons",
"Convert to exons",
icon("hourglass-start"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("exons", "This converts your gene list to the respective exon coordinates"),
tags$hr(),
withBusyIndicatorUI(
actionButton("exons_utrs",
"Convert to exons plus UTRs",
icon("hourglass-start"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("exons_utrs", "This converts your gene list to the respective exon coordinates including UTRs"),
tags$hr(),
withBusyIndicatorUI(
actionButton("exonsplusfive",
"Increase exon sizes",
icon("plus"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("exonsplusfive", "Increases your exon sizes by + 10 bp in both directions"),
tags$hr(),
downloadButton("DL_genes",
"Download gene list",
class = "btn-primary"),
bsTooltip("DL_genes", "Contains the genes you entered on the left"),
tags$hr(),
downloadButton("DL_exons",
"Download exon list",
class = "btn-primary"),
bsTooltip("DL_exons", "Contains the exon boundaries of your picked genes"),
tags$hr(),
actionButton("view_genes",
"File viewer: genes",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_genes", "To check your gene list, click here"),
tags$hr(),
actionButton("view_exons",
"File viewer: exons",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_exons", "To check your exon list, click here")
), #close sidebarpanel
mainPanel(
textAreaInput("genelist",
"Paste your gene(s) here (one per line; case sensitive)",
width = "350px"),
bsTooltip("genelist", "e.g. BRCA1"),
#this is only shown, when the program is working
hidden(div(id = "working0",
tags$h3("shinyMIPs is working, please stand by.")
)), #close hidden
#file viewer, only shown upon button click
hidden(div(id = "hidden_viewer1",
tableOutput("file_viewer1")
)), #close hidden
hidden(div(id = "hidden_viewer2",
tableOutput("file_viewer2")
)) #close hidden
) #close mainpanel
) #close sidebarlayout
), #close tabpanel
tabPanel("Non-coding",
titlePanel("Choose (non-coding) regions to be covered"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
withBusyIndicatorUI(
actionButton("regions",
"Create list of regions from input",
icon("hourglass-start"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("regions", "This creates a list of your regions of interest on the server (using your input on the left"),
tags$hr(),
withBusyIndicatorUI(
actionButton("regions_by_file",
"Create a list of regions from upload",
icon("hourglass-start"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("regions_by_file", "This creates a list of your regions of interest on the server (using your uploaded file"),
tags$hr(),
downloadButton("DL_regions",
"Download list of regions",
class = "btn-primary"),
bsTooltip("DL_regions", "Contains the regions you entered on the left"),
tags$hr(),
actionButton("view_regions", "File viewer: regions",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_regions", "To check your region list, click here")
), #close sidebarpanel
mainPanel(
textAreaInput("regionlist",
"Paste your regions of interest here (one region per line; space-/tab-delimited; format example: chr1 1234000 1239000 region_name)",
width = "350px"),
bsTooltip("regionlist", "e.g. chr2 42209543 4238600 noncoding_region (those four strings have to be space-delimited)"),
tags$br(),
tags$h4("Alternative method: upload a file containing your regions."),
fileInput("upload_regions", "Choose file to upload (following the same format as above, tab-delimited)",
accept = c(
"text/csv",
"text/tab-separated-values",
"text/plain",
".csv",
".tsv"
) #close accept of fileinput
), #close fileinput
#this is only shown, when the program is working
hidden(div(id = "working1",
tags$h3("shinyMIPs is working, please stand by.")
)), #close hidden
#file viewer, only shown upon button click
hidden(div(id = "hidden_viewer5",
tableOutput("file_viewer5")
)) #close hidden
) #close mainpanel
) #close sidebarlayout
) #close tabpanel
) #close tabsetpanel
), #close tabpanel
tabPanel(div(icon("hourglass-2"), " Create MIPs"),
titlePanel("Create MIPs (advanced options for advanced users only)"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
withBusyIndicatorUI(
actionButton("mips",
"Create MIP files",
icon("hourglass-half"),
class = "btn-primary")
),#close withbusyindicatorui
bsTooltip("mips", "Start the MIPgen pipeline"),
tags$hr(),
actionButton("advanced",
"Toggle advanced options",
icon("cog"),
class = "btn-primary"),
bsTooltip("advanced", "Seriously, watch what you are doing!"),
tags$hr(),
downloadButton("DL_picked_mips",
"Download MIP list",
class = "btn-primary"),
bsTooltip("DL_picked_mips", "Contains the MIPs picked by MIPgen"),
tags$hr(),
downloadButton("DL_snp_mips",
"Download SNP MIP list",
class = "btn-primary"),
bsTooltip("DL_snp_mips", "Contains the alternative SNP MIPs picked by MIPgen"),
tags$hr(),
downloadButton("DL_failed",
"Download list of failed regions",
class = "btn-primary"),
bsTooltip("DL_failed", "If MIPgen failed to cover any of your provided exons/regions, this file will contain the coordinates. If the file does not exist, you are good to go"),
tags$hr(),
actionButton("view_picked_mips",
"File viewer: MIPs",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_picked_mips", "To check your list of picked MIPs, click here"),
tags$hr(),
actionButton("view_snp_mips",
"File viewer: SNP MIPs",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_snp_mips", "To check your list of SNP MIPs, click here")
), #close sidebarpanel
mainPanel(
fluidRow(
column(3,
sliderInput("capture_size",
"Min. and max. capture size",
min = 100,
max = 600,
value = c(210,230)),
bsTooltip("capture_size", "Sets the range for the length of the targeting arms plus the insert"),
sliderInput("bwa_threads",
"Threads",
min = 1,
max = 10,
value = 1),
bsTooltip("bwa_threads", "Determines, how many threads are used for BWA"),
radioButtons("double_tiling",
"Double Tiling",
choices = c("off", "on")),
bsTooltip("double_tiling", "Allows you to generate MIPs on both strands for each position")
), #close first column
#these are hidden initially
hidden(div(id= "advanced_options",
column(3,
textInput("arm_length_sums",
"Min. and max. sum of arm lengths",
value = "40,41,42,43,44,45"),
bsTooltip("arm_length_sums", "Sets the allowed sums of extension and ligation arm size (format: sum1,sum2,sum3,...)"),
sliderInput("ext_min_length",
"Min. length of extension arm",
min = 12,
max = 30,
value = 16),
bsTooltip("ext_min_length", "Rather self-explanatory"),
sliderInput("lig_min_length",
"Min. length of ligation arm",
min = 12,
max = 30,
value = 18),
bsTooltip("lig_min_length", "Rather self-explanatory")
), #close second column
column(3,
sliderInput("tag_size",
"Extension arm tag size",
min = 0,
max = 8,
value = 5),
bsTooltip("tag_size", "Higher: less specific binding; lower: fewer unique smMIPs"),
sliderInput("max_overlap",
"Max. MIP overlap",
min = 0,
max = 100,
value = 30),
bsTooltip("max_overlap", "Determines the maximum overlap of target regions between two MIPs"),
radioButtons("score_method",
"Scoring method",
choices = c("logistic", "mixed", "svr")),
bsTooltip("score_method", "Logistic: fast; svr: slow (not working); mixed: as the name suggests (not working)"),
bsAlert("score_method_alert")
) #close third column
)) #close hidden
), #close fluidrow
#this is only shown, when the program is working
hidden(div(id = "working2",
tags$h3("shinyMIPs is working, please stand by.")
)), #close hidden
#file viewer, only shown upon button click
hidden(div(id = "hidden_viewer3",
tableOutput("file_viewer3")
)), #close hidden
hidden(div(id = "hidden_viewer4",
tableOutput("file_viewer4")
)) #close hidden
) #close mainpanel
) #close sidebarlayout
), #close tabpanel
tabPanel(div(icon("hourglass-3"), " Generate UCSC Track"),
titlePanel("MIPs to UCSC Track"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
withBusyIndicatorUI(
actionButton("ucsc",
"Create UCSC Track",
icon("hourglass-end"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("ucsc", "Uses the created MIPs to create a track for UCSC"),
tags$hr(),
downloadButton("DL_ucsc",
"Download UCSC Track",
class = "btn-primary"),
bsTooltip("DL_ucsc", "Contains a .bed track for use in UCSC.")
), #close sidebarpanel
mainPanel(
fluidRow(
column(3,
textInput("ucsc_name",
"Name of UCSC track (snake_case!)",
value= "this_is_an_example"), #should be the chosen prefix
bsTooltip("ucsc_name", "This will be shown in the UCSC genome browser")
), #close first column
column(3,
#uses the colourpicker tool
colourInput("plus_strand",
"Colour of plus strand",
value = "#2FA4E7"),
bsTooltip("plus_strand", "Changes the colour of the plus strand in your UCSC track")
), #close second column
column(3,
#uses the colourpicker tool
colourInput("minus_strand",
"Colour of minus strand",
value = "#033C73"),
bsTooltip("minus_strand", "Changes the colour of the minus strand in your UCSC track")
) #close third column
), #close fluidrow
#this is only shown when the program is working
hidden(div(id = "working3",
tags$h3("shinyMIPs is working, please stand by.")
)) #close hidden
) #close mainpanel
) #close sidebarlayout
), #close tabpanel
tabPanel(div(icon("balance-scale"), " Rebalancing"),
tabsetPanel(id="analysis_choice",
tabPanel("Intro",
tags$br(),
tags$h4("Here you can perform some simple analyses to increase your MIPs\' performance in subsequent experiments.")
), #close tabpanel
tabPanel("Grep-like",
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
withBusyIndicatorUI(
actionButton("grep_input",
"Read uploaded file",
icon("upload"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("grep_input", "Convert uploaded file"),
tags$hr(),
actionButton("grep",
"Start grep analysis",
icon("hand-grab-o"),
class = "btn-primary"),
bsTooltip("grep", "Analyse your uploaded file using the grep-like algorithm"),
tags$hr(),
downloadButton("DL_grep",
"Download grep results",
class = "btn-primary"),
bsTooltip("DL_grep", "Contains your grep-analysed results"),
tags$hr(),
actionButton("view_grep",
"File viewer: grep",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_grep", "Check your grep results in a file viewer")
), #close sidebarpanel
mainPanel(
tags$h3("Work in progress..."),
fileInput("upload_grep", "Upload your file here",
accept = c(
"text/csv",
"text/tab-separated-values",
"text/plain",
".csv",
".tsv"
) #close accept of fileinput
), #close fileinput
textInput("grep_barcode",
"Enter your used barcode here"),
bsTooltip("grep_barcode", "Used in the MIPs PCR, see primer list"),
hidden(div(id = "working4",
tags$h3("shinyMIPs is working, please stand by.")
)) #close hidden
) #close mainpanel
) #close sidebarlayout
), #close tabpanel
tabPanel("Align",
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
withBusyIndicatorUI(
actionButton("align_input",
"Read uploaded file",
icon("upload"),
class = "btn-primary")
), #close withbusyindicatorui
bsTooltip("align_input", "Convert uploaded file"),
tags$hr(),
actionButton("align",
"Start align analysis",
icon("bars"),
class = "btn-primary"),
bsTooltip("align", "Analyse your uploaded file using the align function"),
tags$hr(),
downloadButton("DL_align",
"Download align results",
class = "btn-primary"),
bsTooltip("DL_align", "Contains your align-analysed results"),
tags$hr(),
actionButton("view_align",
"File viewer: align",
icon("align-justify"),
class = "btn-primary"),
bsTooltip("view_align", "Check your grep results in a file viewer")
), #close sidebarpanel
mainPanel(
tags$h3("Work in progress..."),
fileInput("upload_align", "Upload your file here",
accept = c(
"text/csv",
"text/tab-separated-values",
"text/plain",
".csv",
".tsv"
) #close accept of fileinput
), #close fileinput
textInput("align_barcode",
"Enter your used barcode here"),
bsTooltip("align_barcode", "Used in the MIPs PCR, see primer list"),
hidden(div(id = "working5",
tags$h3("shinyMIPs is working, please stand by.")
)) #close hidden
) #close mainpanel
) #close sidebarlayout
) #close tabpanel
) #close tabsetpanel
), #close tabpanel
tabPanel(title = div(icon("calculator"), " Calculators"),
tabsetPanel(id="calculators",
tabPanel("Coverage",
tags$br(),
fluidRow(
column(3,
tags$h4("Input"),
numericInput("desired_coverage",
"Coverage",
value = 800),
bsTooltip("desired_coverage", "The coverage you want to achieve"),
sliderInput("duplicates",
"Duplicates",
min = 0,
max = 100,
post = " %",
value = 10),
bsTooltip("duplicates", "The percentage of duplicates expected, default: 10%"),
numericInput("size_of_region",
"Region size",
value = 123456),
bsTooltip("size_of_region", "The size of the region to be sequenced, also see the MIPs calculator"),
numericInput("read_length",
"Read length",
value = 250),
bsTooltip("read_length", "Sequencing size in bp (default: 2x 125, so 250)"),
sliderInput("on_target",
"On target",
min = 0,
max = 100,
post = " %",
value = 90),
bsTooltip("on_target", "Percentage of on-target reads expected, default: 80% to 90%"),
numericInput("sample_number",
"Number of samples",
value = 100),
bsTooltip("sample_number", "How many samples you wish to sequence"),
tags$br(),
actionButton("toggle_calc_info_1",
"Toggle further calculations",
icon("toggle-off"),
class = "btn-primary"),
bsTooltip("toggle_calc_info_1", "Show more information about required output etc."),
hidden(div(id = "hidden_toggle_calc_info_button",
actionButton("toggle_calc_info_2",
"Toggle further calculations",
icon("toggle-on"),
class = "btn-primary"),
bsTooltip("toggle_calc_info_2", "Show less information about required output etc.")
)) #close hidden
), #close column
column(3,
tags$h4("Output HiSeq 2500 v4 (2x 125)"),
hidden(div(id = "hidden_calc_1",
numericInput("output_req_1",
"Required output (bp)",
value = 0),
bsTooltip("output_req_1", "Total output required = region size * coverage / ((1-duplicates/100) * on target/100)"),
numericInput("output_unit_1",
"Output per unit (bp)",
value = 0),
bsTooltip("output_unit_1", "Output per unit = clusters per unit * read length"),
numericInput("output_number_1",
"Number of units",
value = 0),
bsTooltip("output_number_1", "Number of units (flow cells or lanes) = total output required / output per unit")
)), #close hidden
numericInput("output_samples_1",
"Samples per unit",
value = 0),
bsTooltip("output_samples_1", "Number of samples = output per unit / total output required"),
numericInput("output_required_1a",
"Required lanes",
value = 0),
bsTooltip("output_required_1a", "Lanes you need, to achieve your sequencing goal"),
numericInput("output_required_1b",
"Required flow cells",
value = 0),
bsTooltip("output_required_1b", "Flow cells, these lanes amount to"),
numericInput("output_price_1",
"Price in Euro",
value = 0),
bsTooltip("output_price_1", "Your costs")
), #close column
column(3,
tags$h4("Output MiSeq v2 (2x 150)"),
hidden(div(id = "hidden_calc_2",
numericInput("output_req_2",
"Required output (bp)",
value = 0),
bsTooltip("output_req_2", "Total output required = region size * coverage / ((1-duplicates/100) * on target/100)"),
numericInput("output_unit_2",
"Output per unit (bp)",
value = 0),
bsTooltip("output_unit_2", "Output per unit = clusters per unit * read length"),
numericInput("output_number_2",
"Number of units",
value = 0),
bsTooltip("output_number_2", "Number of units (flow cells or lanes) = total output required / output per unit")
)), #close hidden
numericInput("output_samples_2",
"Samples per flow cell",
value = 0),
bsTooltip("output_samples_2", "Number of samples = output per unit / total output required"),
numericInput("output_required_2",
"Required flow cells",
value = 0),
bsTooltip("output_required_2", "Flow cells you need, to achieve your sequencing goal"),
numericInput("output_price_2",
"Price in Euro",
value = 0),
bsTooltip("output_price_2", "Your costs")
), #close column
column(3,
tags$h4("Output MiSeq v3 (2x 300)"),
hidden(div(id = "hidden_calc_3",
numericInput("output_req_3",
"Required output (bp)",
value = 0),
bsTooltip("output_req_3", "Total output required = region size * coverage / ((1-duplicates/100) * on target/100)"),
numericInput("output_unit_3",
"Output per unit (bp)",
value = 0),
bsTooltip("output_unit_3", "Output per unit = clusters per unit * read length"),
numericInput("output_number_3",
"Number of units",
value = 0),
bsTooltip("output_number_3", "Number of units (flow cells or lanes) = total output required / output per unit")
)), #close hidden
numericInput("output_samples_3",
"Samples per flow cell",
value = 0),
bsTooltip("output_samples_3", "Number of samples = output per unit / total output required"),
numericInput("output_required_3",
"Required flow cells",
value = 0),
bsTooltip("output_required_3", "Flow cells you need, to achieve your sequencing goal"),
numericInput("output_price_3",
"Price in Euro",
value = 0),
bsTooltip("output_price_3", "Your costs")
) #close column
) #close fluidrow
), #close tabpanel
tabPanel("MIPs",
tags$br(),
numericInput("mips_amount",
"Number of MIPs",
value = 123),
bsTooltip("mips_amount", "How many MIPs you (will) have"),
numericInput("sequencing_size",
"Sequencing size in bp (default: 2x 125, so 250)",
value = 250),
bsTooltip("sequencing_size", "Also known as read length"),
numericInput("result_mips_calculation",
"Result:",
value = 0),
bsTooltip("result_mips_calculation", "bp you need for your coverage calculation")
) #close tabpanel
) #close tabsetpanel
), #close tabpanel
tabPanel(div(icon("puzzle-piece"), " Analysis"),
titlePanel("Analysis"),
sidebarLayout(position = "right",
sidebarPanel(
actionButton("analysis_start",
"Analyse",
icon("random"),
class = "btn-primary")
), #close sidebarpanel
mainPanel(
tags$br(),
tags$h4("Work in progress...")
) #close mainpanel
) #close sidebarlayout
), #close tabpanel
tabPanel(div(icon("rocket"), "Further tools"),
passwordInput("pw_enter_password", "Enter password"),
actionButton("pw_go", "Go", class = "btn-primary"),
hidden(div(id = "pw_protect",
tabsetPanel(id="Further tools",
tabPanel("Sequence grabber",
titlePanel("Sequence grabber"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
actionButton("get_sequence",
"Get desired sequence",
icon("keyboard-o"),
class = "btn-primary"),
bsTooltip("get_sequence", "Print the sequence according to your entered coordinates")
), #close siderbarpanel
mainPanel(
tags$br(),
textAreaInput("coordinates",
"Coordinates (chrX:Y-Z):",
placeholder = "chr2:5643000-5645000"),
bsTooltip("coordinates", "Input your coordinates here, e.g. 'chr2:5643000-5645000"),
tags$br(),
textAreaInput("sequence",
"Sequence:"),
bsTooltip("sequence", "This is your sequence (after using the button)")
) #close mainpanel
) #close siderbarlayout
), #close tabpanel
tabPanel("Reversecomplement",
titlePanel("Reversecomplement"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
actionButton("make_complementary",
"Make reversecomplement!",
icon("exchange"),
class = "btn-primary"),
bsTooltip("make_complementary", "Creates the reversecomplementary sequence (e.g. for primers)")
), #close sidebarpanel
mainPanel(
tags$br(),
textAreaInput("pre_complementary",
"Your sequence (ACGT only):",
placeholder = "ACGT"),
bsTooltip("pre_complementary", "Enter your sequence"),
textAreaInput("post_complementary",
"Reversecomplementary sequence",
placeholder = "ACGT"),
bsTooltip("post_complementary", "Obtain your converted sequence")
) #close mainpanel
) #close sidebarlayout
), #close tabPanel
tabPanel("Primers",
titlePanel("Primers"),
tags$br(),
sidebarLayout(position = "right",
sidebarPanel(
actionButton("pick_primers",
"Pick primers",
icon("flask"),
class = "btn-primary"),
bsTooltip("pick_primers", "Picks primers using your specified input")
), #close sidebarpanel
mainPanel(
"Use", a("Primer3", href = "http://primer3.ut.ee/"), "until this is done!"
) #close mainpanel
) #close sidebarlayout
) #close tabpanel
) #close tabsetpanel
)) #close hidden
), #close tabpanel
tabPanel(div(icon("question"), " Help"),
tabsetPanel(id="help",
tabPanel("How to",
tags$br(),
tags$h5("Step 1: Create a prefix, your own unique identifier."),
tags$h5("Step 2: Choose, which genes or genomic regions you want to cover (i.e. sequence)."),
tags$h5("Step 3: Generate MIPs for those regions."),
tags$h5("Step 4: Create a UCSC track to check your MIPs."),
tags$h5("Step 5: Refine your MIPs."),
tags$h5("Step 6: Order your MIPs, for example from", a("IDT.", href = "https://eu.idtdna.com/site")),
tags$h5("Step 7: Perform your sequencing project."),
tags$h5("Step 8: Analyse your data."),
tags$h5("Step 9: Share your findings with the scientific community.")
), #close tabpanel
tabPanel("FAQ",
tags$br(),
tags$h4("Q: How are the MIPs created?"),
tags$h5("A: Using the", a("MIPgen", href = "https://github.com/shendurelab/MIPGEN"), "pipeline. It was created by Evan Boyle and set up at our institute by Leonie Henschel. I provided the graphical user interface, which you are using right now. Furthermore, I modified some of the scripts to better suit this simplified application."),
tags$h4("Q: What is a MIP?"),
tags$h5("A: A MIP is a molecular inversion probe. See", a("this paper", href = "https://www.nature.com/nbt/journal/v21/n6/full/nbt821.html"), "by Hardenbol et al."),
tags$h4("Q: What is a smMIP?"),
tags$h5("A: A smMIP is a single molecule MIP. See", a("this paper", href = "http://genome.cshlp.org/content/23/5/843"), "by Hiatt et al."),
tags$h4("Q: What is UCSC?"),
tags$h5("A: UCSC refers to the Genome Browser by the University of California Santa Cruz. You can find it", a("here.", href = "http://genome-euro.ucsc.edu/cgi-bin/hgGateway")),
tags$h4("Q: Which genome build do you use?"),
tags$h5("A: shinyMIPs is based on hg19."),
tags$h4("Q: Anything else?"),
tags$h5("A: For the tools I also used the twoBitToFa script and the fasta_formatter from the fastx-toolkit.")
) #close tabpanel
) #close tabsetpanel
), #close tabpanel
tabPanel(div(icon("info"), " About"),
tags$br(),
tags$h5(id = "shinyMIPs_font",
"shinyMIPs",
align = "center"),
tags$h5("2020",
align = "center")
) #close tabpanel
) #close navbarpage
) #close taglist
# server ------------------------------------------------------------------
server <- function(input, output, session){
#wordcloud
WORDS <- as.data.frame(read.table("./refs/wordcloud.txt",
header = FALSE))
output$wordcloud <- renderPlot({
wordcloud(words = WORDS$V1,
freq = WORDS$V2,
min.freq = 0.1,
random.color = TRUE,
colors = c("#2FA4E7", "#033C73", "#73A839"))
}) #close renderplot
#create gene list
observeEvent(input$genes, {
withBusyIndicatorServer("genes", {
withProgress(message = 'Creating gene list',
value = 0, {
shinyjs::show("working0")
genevariable <- input$genelist
write.table(genevariable,
paste("./data/",
input$prefix,
".genes.txt",
sep = ""),
row.names = FALSE,
col.names = FALSE,
quote = FALSE)
system(paste("echo Gene list successfully created. \n
echo Exon conversion is now available. \n
echo If necessary, a list containing the genes can be downloaded on the right. \n
echo ")
) #close system
incProgress(0.3,
detail = "Reading input")
Sys.sleep(1)
incProgress(0.3,
detail = "Writing list")
Sys.sleep(1)
incProgress(0.3,
detail = "Saving")
Sys.sleep(1)
incProgress(0.1,
detail = "Done")
}) #close withprogress
}) #close withbusyindicatorserver
shinyjs::hide("working0",
anim = TRUE,
animType = "fade",
time = 1.0)
}) #close observeevent
#create exons from gene list
observeEvent(input$exons, {
withBusyIndicatorServer("exons",{
withProgress(message = 'Creating exon list',
value = 0, {
shinyjs::show("working0")
system(paste("sh ./scripts/extract_coding_gene_exons.sh",
paste("./data/",
input$prefix,
".genes.txt",
sep = ""),
"./refs/refGene_hg19.txt >",
paste("./data/",
input$prefix,
".exons.bed",
sep = "")
)
) #close system
system(paste("echo Exon list successfully created. \n
echo You may now continue with MIP generation. \n
echo For informative purposes, the exon list can be downloaded as well. \n
echo ")
) #close system
incProgress(0.3,
detail = "Reading genes")
Sys.sleep(1)
incProgress(0.3,
detail = "Finding exons")
Sys.sleep(1)
incProgress(0.3,
detail = "Saving")
Sys.sleep(1)
incProgress(0.1,
detail = "Done")
}) #close withprogress
}) #close withbusyindicatorserver
shinyjs::hide("working0",
anim = TRUE,
animType = "fade",
time = 1.0)
}) #close observeevent
#create exons plus UTRs from gene list
observeEvent(input$exons_utrs, {
withBusyIndicatorServer("exons_utrs", {
withProgress(message = 'Creating exon list',
value = 0, {
shinyjs::show("working0")
system(paste("sh ./scripts/extract_gene_exons_plus_utrs.sh",
paste("./data/",
input$prefix,
".genes.txt",
sep = ""),
"./refs/refGene_hg19.txt >",
paste("./data/",
input$prefix,
".exons.bed",
sep = "")
) #close paste
) #close system
system(paste("echo Exon list successfully created. \n
echo You may now continue with MIP generation. \n
echo For informative purposes, the exon list can be downloaded as well. \n
echo ")
) #close system
incProgress(0.3,
detail = "Reading genes")
Sys.sleep(1)
incProgress(0.3,
detail = "Finding exons")
Sys.sleep(1)
incProgress(0.3,
detail = "Saving")
Sys.sleep(1)
incProgress(0.1,
detail = "Done")
}) #close withprogress
}) #close withbusyindicatorserver
shinyjs::hide("working0",
anim = TRUE,
animType = "fade",
time = 1.0)
}) #close observeevent
#add 5 bp up- and downstream of each exon
observeEvent(input$exonsplusfive, {
withBusyIndicatorServer("exonsplusfive", {
withProgress(message = 'Modifying exons',
value = 0, {
temporary_exons <- read.csv(paste("./data/",
input$prefix,
".exons.bed",
sep = ""),
sep = "\t",
header = FALSE)
temporary_exons[2] <- temporary_exons[2] - 10
temporary_exons[3] <- temporary_exons[3] + 10
write.table(temporary_exons,
paste("./data/",
input$prefix,
".exons.bed",
sep = ""),
row.names = FALSE,
col.names = FALSE,
quote = FALSE,
sep = " ")
shinyjs::show("working0")
incProgress(0.3,
detail = "Reading exons")
Sys.sleep(1)
incProgress(0.3,
detail = "Calculating")
Sys.sleep(1)
incProgress(0.3,
detail = "Saving")
Sys.sleep(1)
incProgress(0.1,
detail = "Done")
}) #close withprogress
}) #close withbusyindicatorserver
shinyjs::hide("working0",
anim = TRUE,
animType = "fade",
time = 1.0)
}) #close observeevent
#download gene list
output$DL_genes <- downloadHandler(filename = function() {(paste(input$prefix,
".genes.txt",
sep = ""))},
content = function(filename){
file.copy(paste("/home/MIPgen/data/",
input$prefix,
".genes.txt",
sep = ""),
filename)
}) #close downloadhandler
#download exon list
output$DL_exons <- downloadHandler(filename = function() {(paste(input$prefix,
".exons.bed",
sep = ""))},
content = function(filename){
file.copy(paste("/home/MIPgen/data/",
input$prefix,
".exons.bed",
sep = ""),
filename)
}) #close downloadhandler
#create regions list
observeEvent(input$regions, {