I am currently trying to use the io_LCMBasis function to convert a Siemens 3T MEGA-sLASER .basis file to the Osprey format. I believe I am correctly following the guidelines from the Osprey documentation, but receiving the error shown below. Am I missing something simple or is this a bug?
I think io_LCMBasis needs the full path to the basis file with the .basis extension. Something like this: file = â/Users/rubi/Documents/MRS/megaslaser_basisset.basisâ;
Thank you for the response! I did try that early on, but got a different error shown below. The documentation here says to use the folder path, so I assumed this was due to the incorrect path format. But if you successfully use it with the full file path, maybe this is the ârealâ error?
Thanks again!
Rubi
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
Error in io_LCMBasis (line 63)
[Read]=io_readlcmraw_basis(LCMBasisSet,conjugate);
Hi Rubi,
I have tested io_readlcmraw_basis with the complete path of a .basis file and it works. Maybe you have to test this function first. Your new error âError: Character vector is not terminated properlyâ can be caused by a â â â too much or too less.
Hi,
I met same problem too. And I tried to use the comp complete path of .basis file, it doesnât work for me.
The .basis file is dowloaded from the website of LCModel
Hi Chuyue,
You have the newest version of Osprey, am I right? I just have used the script of the older one. I see, that the option âconjugateâ is new:
[BASIS] = io_LCMBasis(LCMBasisSet, addMMFlag, sequence, editTarget, conjugate)
, but should set to 1 for default:
if nargin < 5
conjugate = 1;
if nargin < 4
editTarget = ânoneâ;
if nargin < 3
addMMFlag = 1;
if nargin < 2
sequence = âuneditedâ;
end
end
end
end
To define the default values, addMMFlag and sequence are swapped, but that shouldnât be the problem because you have defined these (in your example nargin = 4).
I know this error especially when the end of a string isnât defined (e.g. missing ').
To limit the reason for this error, you can try
[Read] = io_readlcmraw_basis(file,1)
and see if you have a more informative error message which can help.
I donât have an answer, but at this stage I would be trying to narrow the scope a bit⌠unfortunately your error message doesnât identify a particular line in io_readlcmraw_basis, which makes it a bit less obvious.
I would suggest,
Confirm that the âcorrectâ io_readlcmraw_basis function is being called⌠if you also have FID-A installed separately from Osprey, this may complicate matters. At the matlab prompt, type which io_readlcmraw_basis, the response should be the libraries/FID-A subfolder of your Osprey installation. If you see anything else, remove that folder from your matlab search path and try again. This probably wonât solve your problem, but will avoid confusion later.
Try calling io_readlcmraw_basis directly, like this: io_readlcmraw_basis('D:/software_backup/mrs-basis-sets-LCModel/7t/gamma_press_te10_7t_v1.basis');
Do you see the same error? [EDIT: already suggested by @hraum â sorry, I missed that in the previous reply]
Try changing to the basis set folder and run io_readlcmraw_basis again, eg:
cd D:/software_backup/mrs-basis-sets/LCModel/7t/
io_readlcmraw_basis('gamma_press_te10_7t_v1.basis')
Do you have any other .basis files you could check with?
A bit of a long shot, but I wonder if something with your systemâs language settings/character encoding might be creating an issue. Could you please check, initially, the output of:
get(0,'Language')
java.util.locale.getDefault()
Let me know how that goes, and I can hopefully come back with some further suggestionsâŚ
Thank you for the reply. I use the newest 2.5.0 version of Osprey. And I tried use [Read] = io_readlcmraw_basis(file,1), but there still the same error:
I found there is only one input in the io_readlcmraw_basis function as it mentioned in the codeďź
% USAGE:
% out=io_readlcmraw_basis(filename);
%
% DESCRIPTION:
% Reads entire LCModel .basis file into multiple FID-A data structures in MATLAB.
%
% INPUTS:
% filename = filename of LCModel .basis file.
%
% OUTPUTS:
% out = Input basis set saved as a structure in which each field is
% an individual metabolite basis spectrum in FID-A structure
% format.
function [out]=io_readlcmraw_basis(filename)
So I tried [Read] = io_readlcmraw_basis(file), but there is still the same error:
Please ignore my earlier response. Iâve just done some local testing and found an issue in io_readlcmraw_basis.m; Iâll come back in 5-10 minutes with a fixâŚ
Hi Alex,
Than you for the advice, I have removed FID-A from matlab path, but it not work, I tried directly calling, reading different basis set, but still the same error occured. And I tried check the language setting, but java.util.locale.getDefault not work, I used java.lang.System.getProperty instead of it.
pwd
ans =
'D:\software_backup\mrs-basis-sets-LCModel\7t'
io_readlcmraw_basis(âD:/software_backup/mrs-basis-sets-LCModel/7t/gamma_press_te10_7t_v1.basisâ);
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
io_readlcmraw_basis(âD:/software_backup/mrs-basis-sets-LCModel/7t/gamma_press_te288_7t_v1.basisâ)
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
io_readlcmraw_basis(âgamma_press_te288_7t_v1.basisâ)
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
io_readlcmraw_basis(âgamma_press_te10_7t_v1.basisâ)
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
io_readlcmraw_basis(âbasis_siemens_steam5.BASISâ)
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
io_readlcmraw_basis(âD:/software_backup/mrs-basis-sets-LCModel/7t/basis_siemens_steam5.BASISâ)
Error using io_readlcmraw_basis
Error: Character vector is not terminated properly.
Please try with the attached version of io_readlcmraw_basis (again, you might need to adjust your path to make sure this one is used).
If you look at your basis set, I think youâll find tags like âMETABO_CONTAMâ and METABO_SINGLET", which are included in some basis sets generated by some software, but not all. The script was confusing these for METABOlite names, extracting random bits of strings (which may have included quotes), and using these in evalâd code⌠hence the error message without line numbers. Around line 182 is where the invalid metabolite names were being evalâd.
You could also probably just delete the METABO_CONTAM and METABO_SINGLET lines from your basis file, unless theyâre being used for something.
Hi Chuyue,
to your comment that youâve found only one input to io_readlcmraw_basis, like alex said, please check if you use the right script. When I look at the default branch (develop) in github
(osprey/libraries/FID-A/inputOutput/io_readlcmraw_basis.m at develop ¡ schorschinho/osprey ¡ GitHub), in line 19 you should see also the second input âconjugateâ. Also in your first error message, you see that your io_LCMBasis script works with io_readlcmraw_basis with two inputs.
So your io_LCMBasis script and the used function donât fit together.
Hi, Alex and Heiner,
Thank you for your advices. It is the problem of io_readlcmraw_basis,. I ajdusted the path and used io_readlcmraw_basis provided by Alex, and it worked.
Iâve tested the fix a bit further, on all the basis sets I had available, and updated the code very slightly to handle extra white space inside the quotes. So the attached version is preferable.