Skip to content

Commit

Permalink
update to version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pantakis committed Feb 21, 2023
1 parent 1619784 commit cbbad2e
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 36 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Compiled_for_MAC_OS/.DS_Store
Binary file not shown.

This file was deleted.

Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://ssd.mathworks.com/supportfiles/downloads/R2021b/Release/4/deployment_files/installagent/complete/maci64/InstallAgent_R2021b_Update_4_maci64.zip
File renamed without changes
Binary file not shown.
5 changes: 1 addition & 4 deletions NMRpQuant_GUI/NMRpQuant.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function NMRpQuant_OpeningFcn(hObject, eventdata, handles, varargin)

hM = uimenu('parent',hObject,'Label','Help');
hM2 = uimenu('parent',hObject,'Label','Downloads/Examples');
uimenu(hM,'Label','About the toolbox','Callback',@(~,~)msgbox({'NMRpQuant', 'Version: 1.1', 'License: GNU GPL v3',...
uimenu(hM,'Label','About the toolbox','Callback',@(~,~)msgbox({'NMRpQuant', 'Version: 1.2', 'License: GNU GPL v3',...
'Author: Dr. Panteleimon G. Takis','Contact: p.takis@imperial.ac.uk',...
'National Phenome Centre','Imperial College London'},'About','custom',Icon));
uimenu(hM,'Label','Please also read-cite this article','Callback',@(~,~)web('https://doi.org/10.1021/acs.analchem.1c01618'));
Expand Down Expand Up @@ -2657,9 +2657,6 @@ function ZOOM_Third_ON_Callback(hObject, eventdata, handles)
set(handles.ZOOM_Third_OFF,'ForegroundColor','black');
end




guidata(hObject, handles);

% --- Executes on button press in ZOOM_Third_OFF.
Expand Down
19 changes: 16 additions & 3 deletions internal_functions/Process_lb_NMRdata.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
% Imaginary data vectors (NMRdata_Processed.IData)
%
%
% Last Updated: 12/12/2021
% Last Updated: 21/02/2023
%
% Algorithm contains also adapted parts from rbnmr.m function:
%
Expand All @@ -43,8 +43,21 @@

[NMRdata,Procs,ACQUS,filepath2] = readNMR_real_imag(Folder1r1iprocs);
fa = fopen(fullfile(filepath2,'fid'),'r');
[fid] = fread(fa,'int32','l');
fclose(fa);
switch ACQUS.BYTORDA
case 0
read_bytes='l';
case 1
read_bytes='b';
end
switch ACQUS.DTYPA
case 0
precision='int32';
case 1
precision='double';
case 2
precision='double';
end
[fid] = fread(fa,precision,read_bytes);
fidreal = fid(1:2:length(fid)).*(2^(Procs.NC_proc));
fidimag = fid(2:2:length(fid)).*(2^(Procs.NC_proc));
FID = complex(fidreal,fidimag);
Expand Down
67 changes: 39 additions & 28 deletions internal_functions/getNMRdata.m
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
function [NMRdata] = getNMRdata(Folder1r1iprocs)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright to Dr. Panteleimon G. Takis, 2022 %
% Copyright to Dr. Panteleimon G. Takis, 2019 %
% %
% National Phenome Centre and Imperial Clinical Phenotyping Centre, %
% Department of Metabolism, Digestion and Reproduction, IRDB Building, %
% Imperial College London, Hammersmith Campus, %
% London, W12 0NN, United Kingdom %
% %
% This program is distributed in the hope that it will be useful, %
% but WITHOUT ANY WARRANTY; without even the implied warranty of %
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %
% GNU General Public License for more details. %
% %
% You should have received a copy of the GNU General Public License %
% along with this program. If not, see <https://www.gnu.org/licenses/>.%
% %
% Email: p.takis@imperial.ac.uk %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Reading the real and inaginary part of processed 1D NMR spectra:
Expand All @@ -24,13 +14,7 @@
% Folder1r1iprocs: The NMR folder containing the '1r', '1i', 'procs' files
% for each spectrum.
%
% Outputs
% NMRdata: Structure containing PPM vector (NMRdata.XAxis),
% Intensity Real (NMRdata.Data) and
% Intensity Imaginary data vectors (NMRdata.IData)

%
% Last Updated: 12/01/2022
% Last Updated: 21/02/2023
%
% Algorithm contains also adapted parts from rbnmr.m function:
%
Expand All @@ -39,9 +23,38 @@
%

[NMRdata,Procs,ACQUS,filepath2] = readNMR_real_imag(Folder1r1iprocs);
try
SM_temp = gradient(NMRdata.IData',NMRdata.XAxis');
[~,ii] = find(NMRdata.XAxis' > 2 & NMRdata.XAxis' < 4);

SM_temp_test = SM_temp(1,ii);
SM_temp_test_MAX = max(SM_temp_test);
SM_temp_test_MIN_abs = abs(min(SM_temp_test));
if SM_temp_test_MIN_abs > SM_temp_test_MAX
NMRdata.IData = -1*NMRdata.IData;
Check_phase = 1;
else
Check_phase = 0;
end

try
% try
fa = fopen(fullfile(filepath2,'fid'),'r');
[fid] = fread(fa,'int32','l');
switch ACQUS.BYTORDA
case 0
read_bytes='l';
case 1
read_bytes='b';
end
switch ACQUS.DTYPA
case 0
precision='int32';
case 1 %double
precision='double';
case 2
precision='double';
end

[fid] = fread(fa,precision,read_bytes);
fclose(fa);
fidreal = fid(1:2:length(fid)).*(2^(Procs.NC_proc));
fidimag = fid(2:2:length(fid)).*(2^(Procs.NC_proc));
Expand All @@ -60,14 +73,16 @@
ImagD = -1*(flipud(imag(ImagS)));
ImagD = (ImagD/(2^-Procs.NC_proc));%(1^Procs.NC_proc);
REAL = (flipud(real(ImagS)))/(2^-Procs.NC_proc);
IMAG = ImagD;

if Check_phase == 1
IMAG = -ImagD;
else
IMAG = ImagD;
end
[i,~] = find(NMRdata.XAxis > 1 & NMRdata.XAxis < 5);
TEMP_RE = REAL(i,:);
TEMP_NMRdata = NMRdata.Data(i,:);
TEMP_IMAG = IMAG(i,:);
TEMP_NMRidata = NMRdata.IData(i,:);

[j,~] = find(TEMP_RE == 0);
[q,~] = find(TEMP_NMRdata == 0);
[u,~] = find(TEMP_NMRidata == 0);
Expand All @@ -86,17 +101,13 @@
MM_IM = mean(AAAA_IM);
%MM_IM
if MM_R == MM_IM
FAC = 1;
else
FAC = MM_R/MM_IM;
NMRdata.IData = NMRdata.IData/FAC;
NMRdata.IData = NMRdata.IData/(MM_R/MM_IM);
end
Procs.NC_proc = 0;
NMRdata.FAC = FAC;
catch
clearvars NMRdata
[NMRdata,~,~,~] = readNMR_real_imag(Folder1r1iprocs);
NMRdata.FAC = 1;
end

end
Expand Down

0 comments on commit cbbad2e

Please sign in to comment.