Commit 8f1bccbd authored by Julian Kosciessa's avatar Julian Kosciessa
Browse files

initial commit

parents
File added
*
!*.*
!*/
**/B_data
**/C_figures
**/D_tools
**/T_tools
**/X_documentation
**/X*
**/Y_logs
**/Y_log
**/Z_archive
**/tmp*
**/study_information
**/raw
*.mat
*.xlsx
*.png
*.txt
*.csv
\ No newline at end of file
function A_SS_mse_createCondData_dimension()
% Function creates input data to MSE, segmented by dimensionality condition
% 180126 | JQK adapted to STSWD YA Study
% 180201 | added CSD transform as a preproc step
% | updated FieldTrip version to make this work
% 180606 | adapted to STSWD rest
%% initialize
restoredefaultpath;
clear all; close all; pack; clc;
%% set up paths
pn.root = '/Volumes/LNDG/Projects/StateSwitch/dynamic/data/eeg/rest/';
%pn.root = '/Users/kosciessa/Desktop/mntTardis/STSWD_Rest/WIP_eeg/';
pn.dataIn = [pn.root, 'A_preproc/SA_preproc_study/B_data/C_EEG_FT/'];
pn.dataOut = [pn.root, 'B_analyses/A_MSE_CSD_multiVariant/B_data/B_MSE_Segmented_Dim_Input/']; mkdir(pn.dataOut);
pn.tools = [pn.root, 'B_analyses/A_MSE_CSD_multiVariant/T_tools/'];
addpath([pn.tools, 'fieldtrip-20170904/']);
ft_defaults
%% filenames
% N = 47 YA, 52 OAs
% 2201 - no rest available; 1213 dropped (weird channel arrangement)
IDs = {'1117';'1118';'1120';'1124';'1126';'1131';'1132';'1135';'1136';'1138';...
'1144';'1151';'1158';'1160';'1163';'1164';'1167';'1169';'1172';'1173';...
'1178';'1182';'1215';'1216';'1219';'1221';'1223';'1227';'1228';...
'1233';'1234';'1237';'1239';'1240';'1243';'1245';'1247';'1250';'1252';...
'1257';'1261';'1265';'1266';'1268';'1270';'1276';'1281';...
'2104';'2107';'2108';'2112';'2118';'2120';'2121';'2123';'2125';'2129';...
'2130';'2131';'2132';'2133';'2134';'2135';'2139';'2140';'2145';'2147';...
'2149';'2157';'2160';'2202';'2203';'2205';'2206';'2209';'2210';...
'2211';'2213';'2214';'2215';'2216';'2217';'2219';'2222';'2224';'2226';...
'2227';'2236';'2237';'2238';'2241';'2244';'2246';'2248';'2250';'2251';...
'2252';'2258';'2261'};
%% preproc the data
fprintf('\n\nSubject directory: %s . . .\n', pn.dataIn)
cd(pn.dataIn)
cond_names = {'EC'; 'EO'};
for indID = 1:numel(IDs)
for indCond = 1:2
% load dataset
fprintf('Loading Subject %s %s: . . .\n', IDs{indID}(1:4), cond_names{indCond})
datfile = dir(sprintf('%s_rest_EEG_Rlm_Fhl_rdSeg_Art_%s.mat', IDs{indID}(1:4), cond_names{indCond}));
if isempty(datfile); break; end
cfg.inputfile = fullfile(pn.dataIn, datfile.name);
dataCond = load(cfg.inputfile);
data = dataCond.data;clear dataCond;
cfg_old = data.cfg;
% CSD transform
csd_cfg = [];
csd_cfg.elecfile = 'standard_1005.elc';
csd_cfg.method = 'spline';
data = ft_scalpcurrentdensity(csd_cfg, data);
data.cfg = cfg_old; clear cfg_old;
data.cfg.csd = csd_cfg;
% check that each trial has 1500 samples
for indTrial = 1:size(data.trial,2)
sampleAmount(indTrial) = numel(data.time{indTrial});
end
if mean(sampleAmount) ~=1500
error('Unequal samples! Check!');
end
% % change the temporal trial definition
% for indTrial = 1:size(data.trial,2)
% sampleAmount(indTrial) = numel(data.time{indTrial});
% data.time{indTrial} = data.time{1};
% end
% % equalize data duration (if necessary)
% for indTrial = 1:numel(data.trial)
% data.time{indTrial} = -1.5:1/500:1.498;
% end
% % delete trials which are shorter than target
% deletionTrials = find(sampleAmount < 1500);
% if ~isempty(deletionTrials)
% disp(['Deleting trials ', num2str(deletionTrials)]);
% data.time(deletionTrials) = [];
% data.trial(deletionTrials) = [];
% end
% if numel(data.trial)<10
% error('Too few trials. Check accuracy of trial definition.')
% end
save([pn.dataOut, sprintf('%s_%s_MSE_IN.mat', IDs{indID}(1:4), cond_names{indCond})],'data');
clear data;
end
end
end
\ No newline at end of file
function B_runMSE(indID, indCond, variant) %% set up paths if ismac pn.root = '/Users/kosciessa/Desktop/mntTardis/STSWD_Rest/WIP_eeg/'; pn.tools = [pn.root, 'A_MSE_CSD_multiVariant/T_tools/']; addpath([pn.tools, 'mMSE/']); addpath([pn.tools, 'fieldtrip-20170904/']); ft_defaults else pn.root = '/home/mpib/kosciessa/STSWD_Rest/WIP_eeg/'; pn.tools = [pn.root, 'A_MSE_CSD_multiVariant/T_tools/']; end pn.dataIn = [pn.root, 'A_MSE_CSD_multiVariant/B_data/B_MSE_Segmented_Dim_Input/']; pn.dataOut = [pn.root, 'A_MSE_CSD_multiVariant/B_data/C_MSE_Output_v1/']; mkdir(pn.dataOut); %% select data cfg.ID = indID; cfg.cond = indCond; cfg.variant = variant; load([pn.dataIn, sprintf('%s_%s_MSE_IN.mat', cfg.ID, cfg.cond)]) %% setup mMSE % artificial trials have been created from -1.5 to 1.5 cfg.toi = 0; % across extended periods cfg.timwin = 2.9; cfg.timescales = [1:42]; % scale list cfg.m = 2; % pattern length cfg.r = 0.5; % similarity criterion if strcmp(variant, 'hp') cfg.timescales = [1:3:42]; % scale list cfg.coarsegrainmethod = 'filtskip'; cfg.filtmethod = 'hp'; cfg.recompute_r = 'perscale_toi_sp'; elseif strcmp(variant, 'bp') cfg.coarsegrainmethod = 'filtskip'; cfg.filtmethod = 'bp'; cfg.recompute_r = 'perscale_toi_sp'; elseif strcmp(variant, 'filtskip') cfg.coarsegrainmethod = 'filtskip'; cfg.filtmethod = 'lp'; cfg.recompute_r = 'perscale_toi_sp'; elseif strcmp(variant, 'pointavg') cfg.coarsegrainmethod = 'pointavg'; cfg.filtmethod = 'no'; cfg.recompute_r = 'perscale_toi_sp'; elseif strcmp(variant, 'vanilla') cfg.coarsegrainmethod = 'pointavg'; cfg.filtmethod = 'no'; cfg.recompute_r = 'per_toi'; end mse = ft_entropyanalysis(cfg, data); %% save output save([pn.dataOut, sprintf('%s_%s_MSE_OUT_%s_v2.mat', cfg.ID, cfg.cond, cfg.variant)], 'mse', 'cfg') end
\ No newline at end of file
#!/bin/bash
# call the BOSC analysis by session and participant
cd /home/mpib/kosciessa/STSWD_Rest/WIP_eeg/A_MSE_CSD_multiVariant/A_scripts/B2_MSE_tardis/
# N = 47 YA, 52 OAs
# 2201 - no rest available; 1213 dropped (weird channel arrangement)
IDS="1117 1118 1120 1124 1126 1131 1132 1135 1136 1138 1144 1151 1158 1160 1163 1164 1167 1169 1172 1173 1178 1182 1215 1216 1219 1221 1223 1227 1228 1233 1234 1237 1239 1240 1243 1245 1247 1250 1252 1257 1261 1265 1266 1268 1270 1276 1281 2104 2107 2108 2112 2118 2120 2121 2123 2125 2129 2130 2131 2132 2133 2134 2135 2139 2140 2145 2147 2149 2157 2160 2202 2203 2205 2206 2209 2210 2211 2213 2214 2215 2216 2217 2219 2222 2224 2226 2227 2236 2237 2238 2241 2244 2246 2248 2250 2251 2252 2258 2261"
CONDS="EC EO"
#VARIANTS="hp bp filtskip pointavg vanilla"
VARIANTS="hp"
for indID in $IDS ; do
for indCond in $CONDS ; do
for indVariant in $VARIANTS ; do
echo "#PBS -N MSE_CSD_${indID}_${indCond}_${indVariant}" > job
echo "#PBS -l walltime=60:00:0" >> job
echo "#PBS -l mem=16gb" >> job
echo "#PBS -j oe" >> job
echo "#PBS -o /home/mpib/kosciessa/STSWD_Rest/WIP_eeg/A_MSE_CSD_multiVariant/Y_logs" >> job
echo "#PBS -m n" >> job
echo "#PBS -d ." >> job
echo "./B_runMSE_run.sh /opt/matlab/R2016b ${indID} ${indCond} ${indVariant}" >> job
qsub job
rm job # delete job file after execution
done
done
done
#!/bin/bash
# This script prepares tardis by compiling the necessary function in MATLAB.
ssh tardis # access tardis
# check and choose matlab version
module avail matlab
module load matlab/R2016b
# compile functions
matlab
pn.rootDir = '/home/mpib/kosciessa/STSWD_Rest/WIP_eeg/A_MSE_CSD_multiVariant/';
%% add fieldtrip toolbox
addpath([pn.rootDir, 'T_tools/fieldtrip-20170904/']); ft_defaults(); ft_compile_mex(true)
%% go to analysis directory containing .m-file
cd([pn.rootDir, 'A_scripts/B2_MSE_tardis/'])
%% compile function and append dependencies
mcc -m B_runMSE.m -a '/home/mpib/kosciessa/STSWD_Rest/WIP_eeg/A_MSE_CSD_multiVariant/T_tools/mmse/ft_entropyanalysis.m'
exit
\ No newline at end of file
#!/bin/sh
# script for execution of deployed applications
#
# Sets up the MATLAB Runtime environment for the current $ARCH and executes
# the specified command.
#
exe_name=$0
exe_dir=`dirname "$0"`
echo "------------------------------------------"
if [ "x$1" = "x" ]; then
echo Usage:
echo $0 \<deployedMCRroot\> args
else
echo Setting up environment variables
MCRROOT="$1"
echo ---
LD_LIBRARY_PATH=.:${MCRROOT}/runtime/glnxa64 ;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/bin/glnxa64 ;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/os/glnxa64;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/opengl/lib/glnxa64;
export LD_LIBRARY_PATH;
echo LD_LIBRARY_PATH is ${LD_LIBRARY_PATH};
shift 1
args=
while [ $# -gt 0 ]; do
token=$1
args="${args} \"${token}\""
shift
done
eval "\"${exe_dir}/B_runMSE\"" $args
fi
exit
The List of Excluded Files
Excluded files Exclusion Message ID Reason For Exclusion Exclusion Rule
/opt/matlab/R2016b/toolbox/local/+matlab/+internal/+toolboxes/addInstalledToolboxesToJavaPath.m MATLAB:depfun:req:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /opt/matlab/R2016b/toolbox/local/[+]matlab/[+]internal/[+]toolboxes/
/opt/matlab/R2016b/toolbox/local/+matlab/+internal/+toolboxes/addInstalledToolboxesToPath.m MATLAB:depfun:req:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /opt/matlab/R2016b/toolbox/local/[+]matlab/[+]internal/[+]toolboxes/
/opt/matlab/R2016b/toolbox/local/+matlab/+internal/+zipAddOns/addInstalledZipAddOnsToPath.m MATLAB:depfun:req:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /opt/matlab/R2016b/toolbox/local/[+]matlab/[+]internal/[+]zipAddOns/
/opt/matlab/R2016b/toolbox/local/pathdef.m MATLAB:depfun:req:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /opt/matlab/R2016b/toolbox/local/pathdef[.]m
/opt/matlab/R2016b/toolbox/matlab/codetools/initdesktoputils.m MATLAB:depfun:req:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /opt/matlab/R2016b/toolbox/matlab/codetools/
#!/bin/sh
# script for execution of deployed applications
#
# Sets up the MATLAB Runtime environment for the current $ARCH and executes
# the specified command.
#
exe_name=$0
exe_dir=`dirname "$0"`
echo "------------------------------------------"
if [ "x$1" = "x" ]; then
echo Usage:
echo $0 \<deployedMCRroot\> args
else
echo Setting up environment variables
MCRROOT="$1"
echo ---
LD_LIBRARY_PATH=.:${MCRROOT}/runtime/glnxa64 ;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/bin/glnxa64 ;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/os/glnxa64;
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/opengl/lib/glnxa64;
export LD_LIBRARY_PATH;
echo LD_LIBRARY_PATH is ${LD_LIBRARY_PATH};
shift 1
args=
while [ $# -gt 0 ]; do
token=$1
args="${args} \"${token}\""
shift
done
eval "\"${exe_dir}/B_runMSE\"" $args
fi
exit
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment