Merge pull request #6 from Pixelguy14/test/multiplataform

Test for multiplatform implementation
This commit is contained in:
José Julián Sierra Álvarez 2024-10-18 10:32:26 -06:00 committed by GitHub
commit 1dd7eed839
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 17 deletions

View File

@ -32,4 +32,5 @@ activate .
```
using Genie ; Genie.loadapp() ; up()
```
6. And finally open the port that gets generated by Genie to access to the GUI (https://localhost:????)<br />
6. After the package is loaded, open the port generated by Genie to access the GUI by pressing cmd (macOS) or ctrl (Linux/Windows) in the http:// direction, as shown in the figure.
![Open Julia](https://github.com/user-attachments/assets/37e191d7-635d-458f-a1cd-719e2964594f)

30
app.jl
View File

@ -80,6 +80,7 @@ rgb_ViridisPalette =reinterpret(ColorTypes.RGB24, ViridisPalette)
end
@onchange file_name begin
msg = ""
try
if contains(file_name,".imzML")
warning_fr = ""
full_route = joinpath( file_route, file_name )
@ -96,7 +97,9 @@ rgb_ViridisPalette =reinterpret(ColorTypes.RGB24, ViridisPalette)
plotdata = [traceSpectra] # we add the data of spectra to the plot
spectraMz = nothing # Important for memory cleaning
GC.gc() # Trigger garbage collection
if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS
end
warning_fr = "Plot loaded."
Disab_btn = false
full_routeMz2 = full_routeMz # to avoid creating the plot if its the same file read as before
@ -104,9 +107,30 @@ rgb_ViridisPalette =reinterpret(ColorTypes.RGB24, ViridisPalette)
else
warning_fr = "is not an imzML file"
end
elseif contains(file_name,".mzML")
full_routeMz = joinpath( file_route, file_name )
warning_fr = "$(full_routeMz)"
if isfile(full_routeMz) && (full_routeMz2 == "" || full_routeMz2 != full_routeMz) # check if there is an mzML file around # check if the file exists
Disab_btn = true
warning_fr = "Loading plot..."
spectraMz = LoadMzml(full_routeMz)
traceSpectra = PlotlyBase.scatter(x = mean(spectraMz[1,:]), y = mean(spectraMz[2,:]), mode="lines")
plotdata = [traceSpectra] # we add the data of spectra to the plot
spectraMz = nothing # Important for memory cleaning
GC.gc() # Trigger garbage collection
if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS
end
warning_fr = "Plot loaded."
Disab_btn = false
full_routeMz2 = full_routeMz # to avoid creating the plot if its the same file read as before
end
else
full_route = "/"
warning_fr = "is not an imzML file"
warning_fr = "is not an imzML or mzML file"
end
catch e
msg = "There was an error, please verify the file and try again. $(e)"
end
end
@onchange Nmass begin
@ -159,7 +183,9 @@ rgb_ViridisPalette =reinterpret(ColorTypes.RGB24, ViridisPalette)
spectra = nothing # Important for memory cleaning
slice = nothing
GC.gc() # Trigger garbage collection
if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS
end
Disab_btn = false
end
@onbutton ImgMinus begin
@ -216,7 +242,9 @@ rgb_ViridisPalette =reinterpret(ColorTypes.RGB24, ViridisPalette)
lastimgTriq = indeximgTriq
end
GC.gc() # Trigger garbage collection
if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS
end
end
# == Pages ==
# register a new route and the page that will be loaded on access