Skip to content

Commit f1bbeff

Browse files
committed
Modified Dockerfile
1 parent 8f136f1 commit f1bbeff

2 files changed

Lines changed: 50 additions & 67 deletions

File tree

Dockerfile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ RUN installr -d \
2626
-t "make openssl-dev cmake linux-headers apache-arrow-dev" \
2727
-a "openssl libarrow_dataset libarrow" arrow@19.0.1.1
2828

29+
30+
# Make Shiny listen on 3838, 0.0.0.0 by default
31+
RUN printf "\noptions(shiny.port=3838, shiny.host='0.0.0.0')\n" \
32+
>> /usr/local/lib/R/etc/Rprofile.site
33+
34+
2935
#Create work directory and copy required files and folders into it
3036
RUN mkdir -p /app
3137
WORKDIR /app
@@ -40,7 +46,25 @@ COPY inst/hg38_Coordinates.rds /app
4046
COPY inst/hg37_Coordinates.rds /app
4147
COPY tools/ReViewCNV.R ./app.R
4248

43-
CMD R -e "port <- as.numeric(Sys.getenv('PORT', '6868')); shiny::runApp('/app', host='0.0.0.0', port=port)"
49+
50+
51+
# Expose the Shiny port
52+
EXPOSE 3838
53+
54+
55+
# Create non-root user (Alpine BusyBox tools)
56+
RUN addgroup -g 1000 -S shiny \
57+
&& adduser -u 1000 -S -D -H -s /sbin/nologin -G shiny -h /home/shiny shiny \
58+
&& chown -R shiny:shiny /app
59+
USER shiny
60+
61+
# Start the app
62+
CMD ["R", "-q", "-e", "shiny::runApp('/app')"]
63+
64+
65+
66+
67+
4468

4569

4670

tools/ReViewCNV.R

Lines changed: 25 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ library(arrow)
99

1010
# Arguments ---------------------------------------------------------------
1111

12-
# Specify the application port
13-
14-
1512
options(shiny.maxRequestSize = 50 * 1024^2)
16-
1713
options(shiny.fullstacktrace = TRUE)
1814

1915

@@ -398,7 +394,7 @@ server <- function(input, output, session) {
398394

399395
# True set 1 ----------------------------------------------------------------
400396

401-
True_set_1<- shiny::reactive({
397+
True_set_1 <- shiny::reactive({
402398
if (is.null(input$True_set_1)) {
403399
return(NULL)
404400
} else {
@@ -424,10 +420,9 @@ server <- function(input, output, session) {
424420
}
425421
})
426422

427-
428423
# True set 2 ----------------------------------------------------------------
429424

430-
True_set_2<- shiny::reactive({
425+
True_set_2 <- shiny::reactive({
431426
if (is.null(input$True_set_2)) {
432427
return(NULL)
433428
} else {
@@ -455,7 +450,7 @@ server <- function(input, output, session) {
455450

456451
# True set 3 ----------------------------------------------------------------
457452

458-
True_set_3<- shiny::reactive({
453+
True_set_3 <- shiny::reactive({
459454
if (is.null(input$True_set_3)) {
460455
return(NULL)
461456
} else {
@@ -481,8 +476,6 @@ server <- function(input, output, session) {
481476
}
482477
})
483478

484-
485-
486479
# File and FastCall data second individual ----------------------------------
487480

488481
file_data_2_pre <- shiny::reactive({
@@ -1399,7 +1392,6 @@ server <- function(input, output, session) {
13991392
}
14001393
})
14011394

1402-
14031395
# Subsetting True set 2 ------------------------------------------------
14041396

14051397
rects_2_True_set <- shiny::reactive({
@@ -1416,11 +1408,8 @@ server <- function(input, output, session) {
14161408
}
14171409
})
14181410

1419-
1420-
14211411
# Subsetting True set 3 ------------------------------------------------
14221412

1423-
14241413
rects_3_True_set <- shiny::reactive({
14251414
True_set_3() |> filter(Chromosome == input$chr)
14261415
})
@@ -1435,9 +1424,6 @@ server <- function(input, output, session) {
14351424
}
14361425
})
14371426

1438-
1439-
1440-
14411427
# Subsetting variants annotations data ---------------------------------------------
14421428

14431429
Annot_SV_D <- shiny::reactive({
@@ -1495,7 +1481,7 @@ server <- function(input, output, session) {
14951481
})
14961482

14971483
Annotations_subset <- shiny::reactive({
1498-
if(!is.null(rects_1_range())){
1484+
if (!is.null(rects_1_range())) {
14991485
if (input$Genome == "GRCh37") {
15001486
Annotations_37 |>
15011487
filter(Chromosome == input$chr) |>
@@ -1569,8 +1555,9 @@ server <- function(input, output, session) {
15691555
} else {
15701556
return(NULL)
15711557
}
1558+
} else {
1559+
return(NULL)
15721560
}
1573-
else{return(NULL)}
15741561
})
15751562

15761563
CNV1 <- shiny::reactive({
@@ -1834,7 +1821,6 @@ server <- function(input, output, session) {
18341821
"True_set_2",
18351822
"If available load the True set"
18361823
)
1837-
18381824
)
18391825
} else {
18401826
return(NULL)
@@ -2151,7 +2137,6 @@ server <- function(input, output, session) {
21512137
plotly::toWebGL()
21522138
}
21532139

2154-
21552140
# Plot genes annotations --------------------------------------------------
21562141

21572142
fig2 <- plotly::plot_ly(
@@ -2400,17 +2385,16 @@ server <- function(input, output, session) {
24002385
zeroline = FALSE,
24012386
showline = FALSE,
24022387
showticklabels = FALSE,
2403-
showgrid = FALSE))
2388+
showgrid = FALSE
2389+
)
2390+
)
24042391
} else {
24052392
pl_True_set_1 <- NULL
24062393
}
24072394
}
24082395

2409-
2410-
24112396
# Plot True set 2-----------------------------------------------------------
24122397

2413-
24142398
if (!is.null(input$True_set_2)) {
24152399
rects_2_True_2DEL <-
24162400
rects_2_True_set_range() |>
@@ -2569,14 +2553,14 @@ server <- function(input, output, session) {
25692553
zeroline = FALSE,
25702554
showline = FALSE,
25712555
showticklabels = FALSE,
2572-
showgrid = FALSE)
2556+
showgrid = FALSE
2557+
)
25732558
)
25742559
} else {
25752560
pl_True_set_2 <- NULL
25762561
}
25772562
}
25782563

2579-
25802564
# Plot True set 3-----------------------------------------------------------
25812565

25822566
if (!is.null(input$True_set_3)) {
@@ -2737,15 +2721,14 @@ server <- function(input, output, session) {
27372721
zeroline = FALSE,
27382722
showline = FALSE,
27392723
showticklabels = FALSE,
2740-
showgrid = FALSE)
2724+
showgrid = FALSE
2725+
)
27412726
)
27422727
} else {
27432728
pl_True_set_3 <- NULL
27442729
}
27452730
}
27462731

2747-
2748-
27492732
# Plot for the first individual -----------------------------------------------
27502733

27512734
if (!is.null(input$FastCall_Results_1)) {
@@ -3609,9 +3592,7 @@ server <- function(input, output, session) {
36093592
)
36103593
)
36113594
)
3612-
} else if (
3613-
is.null(input$HSLM_3) | is.null(input$FastCall_Results_3)
3614-
) {
3595+
} else if (is.null(input$HSLM_3) | is.null(input$FastCall_Results_3)) {
36153596
pl_1 <- pl_1 |>
36163597
layout(
36173598
yaxis = list(
@@ -3687,7 +3668,7 @@ server <- function(input, output, session) {
36873668
}
36883669

36893670
if (isTRUE(input$GenomeBrowser) & !is.null(input$True_set_1)) {
3690-
if (!is.null(pl_True_set_1) & !is.null(Annotations_list())) {
3671+
if (!is.null(pl_True_set_1) & !is.null(Annotations_list())) {
36913672
pl <- plotly::subplot(
36923673
fig2,
36933674
pl_1,
@@ -3714,14 +3695,11 @@ server <- function(input, output, session) {
37143695
pl_1,
37153696
pl_True_set_1,
37163697
nrows = 3,
3717-
heights = c(1 / 6, 4/6, 1/6),
3698+
heights = c(1 / 6, 4 / 6, 1 / 6),
37183699
shareX = TRUE,
37193700
titleY = TRUE
37203701
)
3721-
}
3722-
3723-
3724-
else {
3702+
} else {
37253703
pl <- plotly::subplot(
37263704
fig2,
37273705
pl_1,
@@ -3731,9 +3709,6 @@ server <- function(input, output, session) {
37313709
titleY = TRUE
37323710
)
37333711
}
3734-
3735-
3736-
37373712
} else if (isTRUE(input$GenomeBrowser) & is.null(input$True_set_1)) {
37383713
if (!is.null(Annotations_list())) {
37393714
pl <- plotly::subplot(
@@ -4654,33 +4629,28 @@ server <- function(input, output, session) {
46544629
)
46554630
}
46564631

4657-
46584632
if (!is.null(input$True_set_2)) {
4659-
if (!is.null(pl_True_set_2)){
4633+
if (!is.null(pl_True_set_2)) {
46604634
pl_B <- plotly::subplot(
46614635
pl_2,
46624636
pl_True_set_2,
46634637
nrows = 2,
4664-
heights = c(4/5, 1 /5),
4638+
heights = c(4 / 5, 1 / 5),
46654639
shareX = TRUE,
46664640
titleY = TRUE
4667-
)}
4668-
else {
4641+
)
4642+
} else {
46694643
pl_B <- pl_2
46704644
}
4671-
46724645
} else {
46734646
pl_B <- pl_2
46744647
}
46754648

4676-
4677-
46784649
pl_B <- pl_B |>
46794650
plotly::partial_bundle() |>
46804651
plotly::toWebGL()
46814652
}
46824653

4683-
46844654
# Plot for third individual -----------------------------------------------
46854655

46864656
if (!is.null(input$FastCall_Results_3) & z$val == -1) {
@@ -5550,39 +5520,28 @@ server <- function(input, output, session) {
55505520
)
55515521
}
55525522

5553-
5554-
5555-
55565523
if (!is.null(input$True_set_3)) {
5557-
if (!is.null(pl_True_set_3)){
5524+
if (!is.null(pl_True_set_3)) {
55585525
pl_C <- plotly::subplot(
55595526
pl_3,
55605527
pl_True_set_3,
55615528
nrows = 2,
5562-
heights = c(4/5, 1 /5),
5529+
heights = c(4 / 5, 1 / 5),
55635530
shareX = TRUE,
55645531
titleY = TRUE
5565-
)}
5566-
else {
5532+
)
5533+
} else {
55675534
pl_C <- pl_3
55685535
}
5569-
55705536
} else {
55715537
pl_C <- pl_3
55725538
}
55735539

5574-
5575-
5576-
55775540
pl_C <- pl_C |>
55785541
plotly::partial_bundle() |>
55795542
plotly::toWebGL()
55805543
}
55815544

5582-
5583-
5584-
5585-
55865545
# Final plot --------------------------------------------------------------
55875546

55885547
if (is.null(input$FastCall_Results_1)) {

0 commit comments

Comments
 (0)