dke-questions > Problems running in batch mode on linux
Showing 1-8 of 8 posts
Display:
Results per page:
Oct 3, 2018  02:10 PM | Live Eikenes
Problems running in batch mode on linux
Hi

I have previously been running DKE in batch mode on Windows, but now I have switched to linux and need to perform DKE analysis in batch mode there.

I do have some problems figuring out how to do that. It says on your web page that linux is run by:

./run_dke.sh

But I do not understand how to put in the DKEparameters into this command. In windows I used the DKEparameters.dat file, and I guess that the parameters in this .dat file are the same parameters that I should use in linux, but in what format should I put them into the linux command? Should it be a .txt file?

Best,
Live
Oct 3, 2018  03:10 PM | David Lewis - Medical University of South Carolina
RE: Problems running in batch mode on linux
Hi Live,

The usage statement is

./run_dke.sh path_to_matlab_compiler DKE_parameter_file

For DKE_parameter_file you can use whatever file name you want — it can be DKEParameters.dat (same as on Windows) or DKEParameters.txt for example.

So if your DKE parameter file is called DKEparameters.txt, and if the path to the MATLAB compiler is /usr/local/matlab/MATLAB_Compiler_Runtime/v714, then the command would be

./run_dke.sh /usr/local/matlab/MATLAB_Compiler_Runtime/v714 DKEparameters.txt

Best,
Dave
Oct 4, 2018  12:10 PM | Live Eikenes
RE: Problems running in batch mode on linux
Hi Dave,

Thanks for your reply.

I managed to run one analysis for one of the id's in the study by writing:

./dke /home/eikeliv/Documents/MILD_TBI_DKE/d1_1001/d1_1001.dat

And by writing this command:

./run_dke.sh usr/local/MATLAB/MATLAB_Compiler_Runtime/v717 /home/eikeliv/Documents/MILD_TBI_DKE/d1_1001/d1_1001.dat

Can I use both these commands?

However, I still dont understand how I can perform analysis in batch mode. I tried making the following script:

#!/bin/bash

for i in 'cat id_mTBI.txt'
do
./dke /home/eikeliv/Documents/MILD_TBI_DKE/${i}/${i}.dat
done

But that does not work.

Best,
Live
Oct 12, 2018  03:10 PM | Emilie McKinnon - MUSC
RE: Problems running in batch mode on linux
Hi Live,

Your for loop has some syntax issues. It should look more like this: 

#!/bin/bash
export ID_file= id_mTBI.txt
SUBJ_IDs=$(cat $ID_file)
for ID in $SUBJ_IDs ; do
./dke /home/eikeliv/Documents/MILD_TBI_DKE/${ID}/${ID}.dat
Done

Regarding the making of your .dat files automatically try using the "sed" command to replace strings within a file.  
Try searching some forums on scripting in bash for specific examples! 

Best,
Emilie
Oct 15, 2018  11:10 AM | Live Eikenes
RE: Problems running in batch mode on linux
Dear Emilie

Thanks for your suggestion. I tried the following:

#!/bin/bash
export ID_file=id_mTBI.txt
SUBJ_IDs=$(cat $ID_file)
for ID in $SUBJ_IDs ; do
./dke /home/eikeliv/Documents/MILD_TBI_DKE/test_loop_dke/${ID}/${ID}.dat
done

But got the following error message:

eikeliv@ntnu14028:~/dke$ ./runDKE_mTBI_test.sh
bash: ./runDKE_mTBI_test.sh: /bin/bash^M: bad interpreter: No such file or directory

But I cannot figure out what is wrong.

Best,
Live
Oct 15, 2018  12:10 PM | Corinne McGill - MUSC
RE: Problems running in batch mode on linux
Hi Live,

Concerning the line that runs DKE, on a Mac you need to use the following format:

./run_dke.sh

not "./dke /home/eikeliv/Documents/MILD_TBI_DKE/test_loop_dke/${ID}/${ID}.dat".

Hope this helps!
Corinne

Originally posted by Live Eikenes:
Dear Emilie

Thanks for your suggestion. I tried the following:

#!/bin/bash
export ID_file=id_mTBI.txt
SUBJ_IDs=$(cat $ID_file)
for ID in $SUBJ_IDs ; do
./dke /home/eikeliv/Documents/MILD_TBI_DKE/test_loop_dke/${ID}/${ID}.dat
done

But got the following error message:

eikeliv@ntnu14028:~/dke$ ./runDKE_mTBI_test.sh
bash: ./runDKE_mTBI_test.sh: /bin/bash^M: bad interpreter: No such file or directory

But I cannot figure out what is wrong.

Best,
Live
Oct 15, 2018  01:10 PM | Live Eikenes
RE: Problems running in batch mode on linux
Hi Corinne,

I am not running this on mac, but on linux.

And I can run one and one job in the terminalwindow by writing:

./dke /home/eikeliv/Documents/MILD_TBI_DKE/d1_1001/d1_1001.dat

But when I try to run it in a .sh script like the one below, and in a loop for all the individuals in my study, I cannot make it to work. 

Any other suggestions?

Best,
Live

Originally posted by Corinne McGill:
Hi Live,

Concerning the line that runs DKE, on a Mac you need to use the following format:

./run_dke.sh

not "./dke /home/eikeliv/Documents/MILD_TBI_DKE/test_loop_dke/${ID}/${ID}.dat".

Hope this helps!
Corinne

Originally posted by Live Eikenes:
Dear Emilie

Thanks for your suggestion. I tried the following:

#!/bin/bash
export ID_file=id_mTBI.txt
SUBJ_IDs=$(cat $ID_file)
for ID in $SUBJ_IDs ; do
./dke /home/eikeliv/Documents/MILD_TBI_DKE/test_loop_dke/${ID}/${ID}.dat
done

But got the following error message:

eikeliv@ntnu14028:~/dke$ ./runDKE_mTBI_test.sh
bash: ./runDKE_mTBI_test.sh: /bin/bash^M: bad interpreter: No such file or directory

But I cannot figure out what is wrong.

Best,
Live
Oct 15, 2018  02:10 PM | David Lewis - Medical University of South Carolina
RE: Problems running in batch mode on linux
Hi Live,

It looks to me like your script runDKE_mTBI_test.sh is in DOS format, which has different end-of-line characters than Linux (or Unix) format. The ^M at the end of the /bin/bash line represents a carriage return, which is at the end of text files created on a Windows PC but not on text files created on a Linux computer.

If your Linux computer has a program dos2unix, you can use that to convert the script to Unix format so that it will run on your Linux computer. If not you might be able to open it in a text editor and save it in Unix format.

Best,
Dave