Fixed some errors to get ready for release

This commit is contained in:
Pixelguy14 2025-02-15 15:40:13 -06:00
parent 455d88cbb7
commit e3e987f0cd
6 changed files with 58 additions and 80 deletions

55
app.jl
View File

@ -59,7 +59,6 @@ include("./julia_imzML_visual.jl")
@in triq3dPlot=false # To generate 3d plot based on current triq image
@in imageCPlot=false # To generate contour plots of current image
@in triqCPlot=false # To generate contour plots of current triq image
@in btnCreateImz=false # To start process for creating imzML and Ibd with mzML and Syncro
# Image change buttons
@in imgPlus=false
@in imgMinus=false
@ -281,6 +280,25 @@ include("./julia_imzML_visual.jl")
btnStartDisable=true
full_route=full_routeMz
end
progressSpectraPlot=true
btnPlotDisable=true
btnStartDisable=true
msg="Loading SUM spectrum plot..."
sTime=time()
plotdata, plotlayout, xSpectraMz, ySpectraMz=sumSpectrumPlot(full_routeMz)
progressSpectraPlot=false
btnPlotDisable=false
if endswith(full_route, "imzML")
btnStartDisable=false
end
if isfile(full_routeMz)
# We enable coord search and spectra plot creation
btnSpectraDisable=false
SpectraEnabled=true
end
fTime=time()
eTime=round(fTime-sTime,digits=3)
msg="Plot loaded in $(eTime) seconds"
end
xCoord=0
yCoord=0
@ -388,9 +406,7 @@ include("./julia_imzML_visual.jl")
else
msg="File does not exist or a parameter is incorrect, please try again."
warning_msg=true
end
spectra=nothing # Important for memory cleaning
slice=nothing
end|
GC.gc() # Trigger garbage collection
if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS
@ -414,30 +430,7 @@ include("./julia_imzML_visual.jl")
btnPlotDisable=true
btnStartDisable=true
msg="Loading plot..."
spectraMz=LoadMzml(full_routeMz)
layoutSpectra=PlotlyBase.Layout(
title="SUM Spectrum plot",
xaxis=PlotlyBase.attr(
title="<i>m/z</i>",
showgrid=true
),
yaxis=PlotlyBase.attr(
title="Intensity",
showgrid=true
),
autosize=false,
margin=attr(l=0,r=0,t=120,b=0,pad=0)
)
try
xSpectraMz=mean(spectraMz[1,:])
ySpectraMz=mean(spectraMz[2,:])
catch e
xSpectraMz=spectraMz[1,1]
ySpectraMz=spectraMz[2,1]
end
traceSpectra=PlotlyBase.scatter(x=xSpectraMz, y=ySpectraMz, mode="lines")
plotdata=[traceSpectra] # We add the data from spectra to the plot
plotlayout=layoutSpectra
plotdata, plotlayout, xSpectraMz, ySpectraMz=sumSpectrumPlot(full_routeMz)
GC.gc() # Trigger garbage collection
if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS
@ -463,7 +456,7 @@ include("./julia_imzML_visual.jl")
end
@onbutton createXYPlot begin
msg="Sum spectrum plot selected"
msg="XY spectrum plot selected"
sTime=time()
if isfile(full_routeMz) # Check if the file exists
progressSpectraPlot=true
@ -917,10 +910,6 @@ include("./julia_imzML_visual.jl")
CompareDialog=true
end
@onbutton btnCreateImz begin
msg="Not yet implemented"
end
# To include a visualization in the spectrum plot indicating where is the selected mass
@onchange Nmass begin
if !isempty(xSpectraMz)

View File

@ -90,13 +90,6 @@
]" :readonly="!SpectraEnabled" :disable="!SpectraEnabled"></q-input>
</div>
</div>
<q-btn id="btnStyle" icon="play_arrow" class="q-ma-sm" v-on:click="btnCreateImz=true" :loading="progressSpectraPlot" :disable="btnSpectraDisable"
label="Generate imzML">
<template v-slot:loading>
<q-spinner-hourglass class="on-left" />
Loading Plot
</template>
</q-btn>
</div>
</div>
<div class="row">

View File

@ -1 +1 @@
ENV["GENIE_ENV"] = "dev"
ENV["GENIE_ENV"] = "prod"

View File

@ -1,18 +0,0 @@
#!/bin/bash
command="julia --project=. start_MSI_GUI.jl"
case "$OSTYPE" in
linux*)
$command
;;
darwin*)
$command
;;
cygwin*|msys*|win32)
julia --project=. start_MSI_GUI.jl
;;
*)
echo "Unsupported OS"
;;
esac

View File

@ -405,3 +405,37 @@ function medianFilterjl(pixMap)
return target
end
# sumSpectrumPlot recieves the local directory of the image as a string,
# returns the layout and data for the surface plotly plot
# this function loads the spectra data and makes a mean to display
# its values in the spectrum plot
function sumSpectrumPlot(mzmlRoute::String)
spectraMz=LoadMzml(mzmlRoute)
xSpectraMz=Float64[]
ySpectraMz=Float64[]
layout=PlotlyBase.Layout(
title="SUM spectrum plot",
xaxis=PlotlyBase.attr(
title="<i>m/z</i>",
showgrid=true
),
yaxis=PlotlyBase.attr(
title="Intensity",
showgrid=true
),
autosize=false,
margin=attr(l=0,r=0,t=120,b=0,pad=0)
)
try
xSpectraMz=mean(spectraMz[1,:])
ySpectraMz=mean(spectraMz[2,:])
catch e
xSpectraMz=spectraMz[1,1]
ySpectraMz=spectraMz[2,1]
end
trace=PlotlyBase.scatter(x=xSpectraMz, y=ySpectraMz, mode="lines")
plotdata=[trace] # We add the data from spectra to the plot
plotlayout=layout
return plotdata, plotlayout, xSpectraMz, ySpectraMz
end

View File

@ -4,26 +4,6 @@ Pkg.activate(".")
Pkg.instantiate()
Pkg.gc()
"""
packages = [
"GenieFramework", "Libz", "PlotlyBase", "CairoMakie", "Colors",
"Statistics", "NaturalSort", "Genie",
"Images", "LinearAlgebra", "NativeFileDialog", "StipplePlotly"
]
# Check for missing packages
for pkg in packages
if !(pkg in keys(Pkg.dependencies()))
Pkg.add(pkg)
end
end
# Add library for mzML imzML from GitHub if missing
if !("julia_mzML_imzML" in keys(Pkg.dependencies()))
Pkg.add(url="https://github.com/CINVESTAV-LABI/julia_mzML_imzML")
end
"""
using Genie
# Load and configure Genie