Skip to content

Commit cbbad2e

Browse files
committed
update to version 1.2
1 parent 1619784 commit cbbad2e

File tree

17 files changed

+57
-36
lines changed

17 files changed

+57
-36
lines changed

.DS_Store

0 Bytes
Binary file not shown.

Compiled_for_MAC_OS/.DS_Store

0 Bytes
Binary file not shown.

Compiled_for_MAC_OS/NMRpQuant_installer_v1.1.app/Contents/Resources/installAgentURL.txt

-1
This file was deleted.

Compiled_for_MAC_OS/NMRpQuant_installer_v1.1.app/Icon

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://ssd.mathworks.com/supportfiles/downloads/R2021b/Release/4/deployment_files/installagent/complete/maci64/InstallAgent_R2021b_Update_4_maci64.zip

NMRpQuant_GUI/NMRpQuant.m

+1-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function NMRpQuant_OpeningFcn(hObject, eventdata, handles, varargin)
7777

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

2660-
2661-
2662-
26632660
guidata(hObject, handles);
26642661

26652662
% --- Executes on button press in ZOOM_Third_OFF.

internal_functions/Process_lb_NMRdata.m

+16-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
% Imaginary data vectors (NMRdata_Processed.IData)
3434
%
3535
%
36-
% Last Updated: 12/12/2021
36+
% Last Updated: 21/02/2023
3737
%
3838
% Algorithm contains also adapted parts from rbnmr.m function:
3939
%
@@ -43,8 +43,21 @@
4343

4444
[NMRdata,Procs,ACQUS,filepath2] = readNMR_real_imag(Folder1r1iprocs);
4545
fa = fopen(fullfile(filepath2,'fid'),'r');
46-
[fid] = fread(fa,'int32','l');
47-
fclose(fa);
46+
switch ACQUS.BYTORDA
47+
case 0
48+
read_bytes='l';
49+
case 1
50+
read_bytes='b';
51+
end
52+
switch ACQUS.DTYPA
53+
case 0
54+
precision='int32';
55+
case 1
56+
precision='double';
57+
case 2
58+
precision='double';
59+
end
60+
[fid] = fread(fa,precision,read_bytes);
4861
fidreal = fid(1:2:length(fid)).*(2^(Procs.NC_proc));
4962
fidimag = fid(2:2:length(fid)).*(2^(Procs.NC_proc));
5063
FID = complex(fidreal,fidimag);

internal_functions/getNMRdata.m

+39-28
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
function [NMRdata] = getNMRdata(Folder1r1iprocs)
22
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3-
% Copyright to Dr. Panteleimon G. Takis, 2022 %
3+
% Copyright to Dr. Panteleimon G. Takis, 2019 %
44
% %
55
% National Phenome Centre and Imperial Clinical Phenotyping Centre, %
66
% Department of Metabolism, Digestion and Reproduction, IRDB Building, %
77
% Imperial College London, Hammersmith Campus, %
88
% London, W12 0NN, United Kingdom %
9-
% %
10-
% This program is distributed in the hope that it will be useful, %
11-
% but WITHOUT ANY WARRANTY; without even the implied warranty of %
12-
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %
13-
% GNU General Public License for more details. %
14-
% %
15-
% You should have received a copy of the GNU General Public License %
16-
% along with this program. If not, see <https://www.gnu.org/licenses/>.%
17-
% %
18-
% Email: p.takis@imperial.ac.uk %
199
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010
%
2111
% Reading the real and inaginary part of processed 1D NMR spectra:
@@ -24,13 +14,7 @@
2414
% Folder1r1iprocs: The NMR folder containing the '1r', '1i', 'procs' files
2515
% for each spectrum.
2616
%
27-
% Outputs
28-
% NMRdata: Structure containing PPM vector (NMRdata.XAxis),
29-
% Intensity Real (NMRdata.Data) and
30-
% Intensity Imaginary data vectors (NMRdata.IData)
31-
32-
%
33-
% Last Updated: 12/01/2022
17+
% Last Updated: 21/02/2023
3418
%
3519
% Algorithm contains also adapted parts from rbnmr.m function:
3620
%
@@ -39,9 +23,38 @@
3923
%
4024

4125
[NMRdata,Procs,ACQUS,filepath2] = readNMR_real_imag(Folder1r1iprocs);
42-
try
26+
SM_temp = gradient(NMRdata.IData',NMRdata.XAxis');
27+
[~,ii] = find(NMRdata.XAxis' > 2 & NMRdata.XAxis' < 4);
28+
29+
SM_temp_test = SM_temp(1,ii);
30+
SM_temp_test_MAX = max(SM_temp_test);
31+
SM_temp_test_MIN_abs = abs(min(SM_temp_test));
32+
if SM_temp_test_MIN_abs > SM_temp_test_MAX
33+
NMRdata.IData = -1*NMRdata.IData;
34+
Check_phase = 1;
35+
else
36+
Check_phase = 0;
37+
end
38+
39+
try
40+
% try
4341
fa = fopen(fullfile(filepath2,'fid'),'r');
44-
[fid] = fread(fa,'int32','l');
42+
switch ACQUS.BYTORDA
43+
case 0
44+
read_bytes='l';
45+
case 1
46+
read_bytes='b';
47+
end
48+
switch ACQUS.DTYPA
49+
case 0
50+
precision='int32';
51+
case 1 %double
52+
precision='double';
53+
case 2
54+
precision='double';
55+
end
56+
57+
[fid] = fread(fa,precision,read_bytes);
4558
fclose(fa);
4659
fidreal = fid(1:2:length(fid)).*(2^(Procs.NC_proc));
4760
fidimag = fid(2:2:length(fid)).*(2^(Procs.NC_proc));
@@ -60,14 +73,16 @@
6073
ImagD = -1*(flipud(imag(ImagS)));
6174
ImagD = (ImagD/(2^-Procs.NC_proc));%(1^Procs.NC_proc);
6275
REAL = (flipud(real(ImagS)))/(2^-Procs.NC_proc);
63-
IMAG = ImagD;
64-
76+
if Check_phase == 1
77+
IMAG = -ImagD;
78+
else
79+
IMAG = ImagD;
80+
end
6581
[i,~] = find(NMRdata.XAxis > 1 & NMRdata.XAxis < 5);
6682
TEMP_RE = REAL(i,:);
6783
TEMP_NMRdata = NMRdata.Data(i,:);
6884
TEMP_IMAG = IMAG(i,:);
6985
TEMP_NMRidata = NMRdata.IData(i,:);
70-
7186
[j,~] = find(TEMP_RE == 0);
7287
[q,~] = find(TEMP_NMRdata == 0);
7388
[u,~] = find(TEMP_NMRidata == 0);
@@ -86,17 +101,13 @@
86101
MM_IM = mean(AAAA_IM);
87102
%MM_IM
88103
if MM_R == MM_IM
89-
FAC = 1;
90104
else
91-
FAC = MM_R/MM_IM;
92-
NMRdata.IData = NMRdata.IData/FAC;
105+
NMRdata.IData = NMRdata.IData/(MM_R/MM_IM);
93106
end
94107
Procs.NC_proc = 0;
95-
NMRdata.FAC = FAC;
96108
catch
97109
clearvars NMRdata
98110
[NMRdata,~,~,~] = readNMR_real_imag(Folder1r1iprocs);
99-
NMRdata.FAC = 1;
100111
end
101112

102113
end

0 commit comments

Comments
 (0)