ASGA Global

Version   0.34.1
Data       10.03.2021
Author    Robert kiewisz
Depends Shiny tidyverse base readxl xlsx zip
License    GPL V3.0

Description Global modules and functions used in ASGA



Check_Data


Description

The ASGA test module to check each uploaded data set before analysis. The test module validates if the uploaded data fitting the expected standardized structure.

Usage

<Upload_Data.R>

Check_Data(i) # Check data routine for raw data 
Check_Analysis(File_name) # Check data routine for analyzed data

Arguments

i single-digit number of the uploaded file
File_name name of the uploaded file


Value

Check_Data object create the following components:

Data_frame
DATA_TEST Test output with numeric value interpreted in Error_Handler GUI ASGA module
AnalysisTest Test output with numeric value interpreted in Upload_Data Global ASGA modules




Upload_Data


Description

The ASGA module to handle uploaded files. There are two routines, one for handling raw data set in .xlsx or .am file format. The second one to handle .xlsx files download after analysis by ASGA.

Usage

<server.R>

callModule(Getfiles_Server, "Home")


Value

Upload_Data object creates the following components:

Data_frame
NUM_FILES Constant storing the value of number uploaded data sets
Amira_df Temp file of raw .am files
AMIRA Constant value if = TURE the Amira filed are used
text_dataset Variable used in Error_Handler GUI ASGA module for displaying messages
datatype Variable used in Error_Handler GUI ASGA module for displaying messages
AnalysisTest Test result variable from Check_Data Global ASGA modules used to break upload if data are not correct


Details

This module works in tandem with Check_Data, Load_Amira Global ASGA modules and Error_Handler GUI ASGA module




Load_Amira


Description

The ASGA module called when the .am file is uploaded by the user. The module is calling three functions (Load_Amira_Nodes, Load_Amira_Points, Load_Amira_Segments) to extract from .am files nodes, points and segments information.

Usage

Load_Amira_Nodes()
Load_Amira_Points()
Load_Amira_Segments()


Example

<Upload_Data.R>

assign(paste("Data", "Node", i, sep = "_"),
              Load_Amira_Nodes(),
              envir = .GlobalEnv
            )

assign(paste("Data", "Points", i, sep = "_"),
              Load_Amira_Points(),
              envir = .GlobalEnv
            )

assign(paste("Data", "Segments", i, sep = "_"),
              Load_Amira_Segments(),
              envir = .GlobalEnv
            )




Load_Data


Description

The ASGA module called for each data set before analysis to the standardized spatial graph for analysis.

Usage

<server.R>

callModule(Load_Data, "Home")


Value

Load_Data object create the following components:

Data_frame
Node Data frame containing columns (Node ID, X Coord, Y Coord, Z Coord) for each node/MT end
Points Data frame containing columns (Point ID, X Coord, Y Coord, Z Coord) for each point in the point cloud
Segments Data frame containing columns (Segment ID,Pole1_00,... ,length, Node ID #1, Node ID #2, Point IDs)
Segments_1_KMT Data frame containing columns (Segment ID, length, Node ID #1, Node ID #2, Point IDs) for k-fiber in Pole_1
Segments_2_KMT Data frame containing columns (Segment ID, length, Node ID #1, Node ID #2, Point IDs) for k-fiber in Pole_2
Segments_KMT Data frame containing columns (Segment ID, length, Node ID #1, Node ID #2, Point IDs) for k-fiber in both poles
Segments_SMT Data frame containing columns (Segment ID, length, Node ID #1, Node ID #2, Point IDs) for SMTs in Pole_1
Pole1 Data frame containing columns (X, Y, Z) for Pole1 coordinates
Pole2 Data frame containing columns (X, Y, Z) for Pole2 coordinates




Save_Data


Description

The ASGA module called at the end of the analysis to save all indicated data sets.

Example

<Save_Data.R>

  # Save Data for SMT ends -----------------------------------------------------
  tryCatch(
    {
      assign(paste("Data", current_data, "Name", sep = "_"),
             Name_df,
             envir = .GlobalEnv
      )
      write.xlsx(
        get(paste("Data", current_data, "Name", sep = "_")),
        paste("Data/", "Data_", current_data, "_Name.xlsx", sep = "")
      )
    },
    error = function(e) {}
  )


Arguments

Name Name of the file in .GlobalEnv to be saved
Name_df Name of the data_frame in .GlobalEnv


Details

Only .xlsx are saved if Amira files were used for analysis then also an overwrite by Save_Amira .am files are saved.




Save_Amira


Description

The function overwrites the uploaded by user Amira files by supplying additional analysis for visualization in ZiB Amira software.

Usage

Save_amira(x, y, Elements, Data_type)


Arguments

x Data_frame name which should be saved in Amira file
y Data_frame column number which should be saved in Amira file
Elements Type of saved data e.g ("Nodes", "Points", "Segments")
Data_type Type of input e.g. ("int", "float", "float[3]")


Details

Data set that are indicated by the user in x[y] need to be sorted accordingly to the segment number.

Before the .am file is overwrite the x[y] object is checked if the defined element number is the same as in the Amira file.

Example

<Save_Data.R>

tryCatch({
    assign(paste("Amira", "Dataset", current_data, sep = "_"),
        Save_amira(DF, 2, "Segments", "float"),
        envir = .GlobalEnv)
}, error = function(e) {}
)




Export_Data


Description

Small unit designed to collect a list of all saved data, zip them and send to download by the user. After the user download data, all files are deleted.

Usage

<server.R>

# to intoduce new formar for downloadHandler
Zip_Files_Format <- list.files(path = getwd(), pattern = Pattern)


Arguments

Pattern Example: ".am$"


Details

Only .xlsx and .am files are collected