Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Kimberly Isobel Meechan
Image Data Explorer
Commits
c1c9f369
Commit
c1c9f369
authored
Sep 21, 2020
by
Jean-Karim Heriche
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to detect use of wrong field separator when uploading data file.
parent
435e9544
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
R/datafile.R
R/datafile.R
+13
-7
No files found.
R/datafile.R
View file @
c1c9f369
...
...
@@ -155,7 +155,7 @@ input_data_server <- function(input, output, session) {
Output_variable
(
"groupsColumn"
,
"groupLabels"
,
"Select column containing group labels"
,
FALSE
,
list
(
maxItems
=
1
))
## Select columns containing ROI coordinates
Select_colums_coordinates
<-
function
(
coor
,
name
,
id
,
label
){
Select_colums_coordinates
<-
function
(
coor
,
name
,
id
,
label
){
output
[[
coor
]]
<-
renderUI
({
colNames
<-
names
(
rv
$
data
)
## Try to infer from name and set as default
...
...
@@ -194,7 +194,7 @@ input_data_server <- function(input, output, session) {
})
## Select column containing image file names as paths relative to image dir
Select_colums_image_file_names
<-
function
(
type
,
grepl_name
,
id
,
label_image
){
Select_colums_image_file_names
<-
function
(
type
,
grepl_name
,
id
,
label_image
){
output
[[
type
]]
<-
renderUI
({
colNames
<-
names
(
rv
$
data
)
selection
<-
NULL
...
...
@@ -245,10 +245,10 @@ input_data_server <- function(input, output, session) {
## Save current choices to a file
output
$
saveConfigFile
<-
downloadHandler
(
filename
=
function
()
{
filename
=
function
(){
data.file
<-
tools
::
file_path_sans_ext
(
basename
(
input
$
datafile
$
name
))
paste0
(
"IDE-saved_input_choices-"
,
data.file
,
"-"
,
Sys.Date
(),
".rds"
)
},
content
=
function
(
file
)
{
content
=
function
(
file
){
## Collect current choices
rv
$
inputChoices
[[
"imgRoot"
]]
<-
parseDirPath
(
roots
,
input
$
imgRoot
)
settings
<-
list
(
"selectedVar"
=
input
$
selectedVar
,
"colsOnHover"
=
input
$
colsOnHover
,
...
...
@@ -285,7 +285,7 @@ input_data_server <- function(input, output, session) {
})
## Populate fields in UI
SelectizeInput
<-
function
(
id
){
SelectizeInput
<-
function
(
id
){
updateSelectizeInput
(
session
=
session
,
inputId
=
id
,
selected
=
rv
$
inputChoices
[[
id
]])
}
...
...
@@ -295,7 +295,7 @@ input_data_server <- function(input, output, session) {
Check_extension_file
()
})
Check_extension_file
<-
function
(){
Check_extension_file
<-
function
(){
# This uses the assertthat package
if
(
see_if
(
has_extension
(
input
$
datafile
$
datapath
,
'csv'
))
==
TRUE
|
see_if
(
has_extension
(
input
$
datafile
$
datapath
,
'txt'
))
==
TRUE
...
...
@@ -308,7 +308,7 @@ input_data_server <- function(input, output, session) {
}
## Read uploaded data file
Upload_data_file
<-
function
(){
Upload_data_file
<-
function
(){
observeEvent
(
input
$
datafile
,
{
if
(
is.null
(
input
$
datafile
))
return
(
NULL
)
...
...
@@ -325,6 +325,12 @@ input_data_server <- function(input, output, session) {
sep
=
input
$
sep
,
quote
=
input
$
quote
,
stringsAsFactors
=
FALSE
)
## Try and detect use of wrong separator
if
(
ncol
(
rv
$
data
)
<
2
)
{
showNotification
(
"Possible use of wrong field separator detected. Please select the correct field separator before uploading the file again."
,
type
=
"warning"
,
duration
=
NULL
)
}
rv
$
data
[,
"id"
]
<-
c
(
1
:
nrow
(
rv
$
data
))
# Used to uniquely identify data points
rv
$
data
[,
"idx"
]
<-
sample
(
c
(
1
:
nrow
(
rv
$
data
)))
# Used to reorder data points
# These don't need to be visible to the user
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment