Added Statistics for mean plot values

This commit is contained in:
José Julián Sierra Álvarez 2024-09-11 12:35:15 -06:00 committed by GitHub
parent e5824dd858
commit 60441a28d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 11 deletions

View File

@ -4,7 +4,7 @@ For this to work you must insert the next lines as they are depicted in your Jul
``` ```
julia julia
] ]
add Pkg Libz ; add https://github.com/CINVESTAV-LABI/julia_mzML_imzML ; add PlotlyBase ; add Genie add Pkg Libz ; add https://github.com/CINVESTAV-LABI/julia_mzML_imzML ; add PlotlyBase ; add Statistics
``` ```
Then open a terminal on the directory "JuliaIMZML_GUI" and put the next code: <br /> Then open a terminal on the directory "JuliaIMZML_GUI" and put the next code: <br />
``` ```

20
app.jl
View File

@ -5,7 +5,8 @@ using GenieFramework
using Pkg using Pkg
using Libz using Libz
using PlotlyBase using PlotlyBase
using julia_mzML_imzML using julia_mzML_imzML
using Statistics
@genietools @genietools
# == Code import == # == Code import ==
@ -46,14 +47,16 @@ using julia_mzML_imzML
@in msgimg = "" @in msgimg = ""
@in msgtriq = "" @in msgtriq = ""
@out full_route = "" @out full_route = ""
@out dims = 0
@out MicroscansMax = 0
layoutSpectra = PlotlyBase.Layout( layoutSpectra = PlotlyBase.Layout(
title = "Spectra Plot", title = "Spectra Plot",
xaxis = PlotlyBase.attr( xaxis = PlotlyBase.attr(
title = "X Axis", title = "m/z",
showgrid = true showgrid = true
), ),
yaxis = PlotlyBase.attr( yaxis = PlotlyBase.attr(
title = "Y Axis", title = "Intensity",
showgrid = true showgrid = true
), ),
width = 450, width = 450,
@ -85,8 +88,7 @@ using julia_mzML_imzML
indeximgTriq = Nmass indeximgTriq = Nmass
lastimg = Nmass lastimg = Nmass
lastimgTriq = Nmass lastimgTriq = Nmass
end end
# the onbutton handler will set the variable to false after the block is executed # the onbutton handler will set the variable to false after the block is executed
#/home/julian/Documentos/Cinvestav_2024/Web/Archivos IMZML/royaimg.imzML #/home/julian/Documentos/Cinvestav_2024/Web/Archivos IMZML/royaimg.imzML
@onbutton Main_Process begin @onbutton Main_Process begin
@ -96,7 +98,10 @@ using julia_mzML_imzML
if isfile(full_route) && Nmass > 0 && Tol > 0 && Tol <= 1 if isfile(full_route) && Nmass > 0 && Tol > 0 && Tol <= 1
msg = "File exists, Nmass=$(Nmass) Tol=$(Tol). Please do not press the start button until confirmation" msg = "File exists, Nmass=$(Nmass) Tol=$(Tol). Please do not press the start button until confirmation"
spectra = LoadImzml(full_route) spectra = LoadImzml(full_route)
spectraMz = LoadMzml(full_route) full_routeMz = split( full_route, "." )[1] * ".mzML" # Splitting the route from imzml to mzml so the plotting can work
spectraMz = LoadMzml(full_routeMz)
dims = size(spectraMz)
MicroscansMax = dims[2] # we get the total of microscans
msg = "File loaded. Please do not press the start button until confirmation" msg = "File loaded. Please do not press the start button until confirmation"
slice = GetSlice(spectra, Nmass, Tol) slice = GetSlice(spectra, Nmass, Tol)
if triqProb != 0 # if we have TrIQ if triqProb != 0 # if we have TrIQ
@ -119,7 +124,8 @@ using julia_mzML_imzML
msgimg = "image with the Nmass of $(Int(Nmass))" msgimg = "image with the Nmass of $(Int(Nmass))"
end end
msg = "The file has been created inside the 'public' folder of the app" msg = "The file has been created inside the 'public' folder of the app"
traceSpectra = PlotlyBase.scatter(x = spectraMz[1, 1], y = spectraMz[2, 1], mode="lines+markers") # traceSpectra = PlotlyBase.scatter(x = spectraMz[1, 1], y = spectraMz[2, 1], mode="lines+markers")
traceSpectra = PlotlyBase.scatter(x = mean(spectraMz, dims=1), y = mean(spectraMz, dims=2), mode="lines+markers")
plotdata = [traceSpectra] # we add the data of spectra to the plot plotdata = [traceSpectra] # we add the data of spectra to the plot
else else
msg = "File does not exist or a parameter was not well inputted" msg = "File does not exist or a parameter was not well inputted"

View File

@ -1,7 +1,7 @@
<header> <header>
<h4>Julia mzML imzML GUI&nbsp;</h4> <h4>Julia mzML imzML GUI&nbsp;</h4>
</header> </header>
<h6>Please make sure the ibd file is located in the same directory as the imzML file</h6> <h6>Please make sure the ibd, the mzML and the imzML files are located in the same directory and have the same name</h6>
<h6>It may take a while to generate the image, don't press the Start button more than once until it finishes</h6> <h6>It may take a while to generate the image, don't press the Start button more than once until it finishes</h6>
<div class="row"> <div class="row">
<div class="st-col col-12 col-sm st-module"> <div class="st-col col-12 col-sm st-module">
@ -27,7 +27,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="st-col col-12 col-sm"> <div class="st-col col-12 col-sm">
<q-toggle id="igqon" v-on:click="triqEnabled" v-model="triqEnabled" color="blue" label="Add TrIQ!"></q-toggle> <q-toggle id="igqon" v-on:click="triqEnabled" v-model="triqEnabled" color="blue" label="Add Threshold Intensity Quantization (TrIQ)!"></q-toggle>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -65,4 +65,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>