Skip to content

Commit ad97938

Browse files
update after running a successfull study
1 parent 204c610 commit ad97938

File tree

9 files changed

+217
-239
lines changed

9 files changed

+217
-239
lines changed

src/A_bdf_merge_sets.m

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
% Restingstate pipepline (2021)
22
% Final version of SRC code 12/6/2021
33
% Merging script to create .set file
4-
5-
subject_list = {'10297' '10331' '10385' '10497' '10553' '10590' '10640' '10867' '10906' '12004' '12006' '12139' '12177' '12188' '12197' '12203' '12206' '12230' '12272' '12415' '12449' '12474' '12482' '12516' '12534' '12549' '12588' '12632' '12735' '12746' '12755' '12770' '12852' '12870' '10033' '10130' '10131' '10257' '10281' '10293' '10360' '10369' '10385' '10394' '10438' '10446' '10463' '10476' '10526' '10545' '10561' '10562' '10581' '10585' '10616' '10748' '10780' '10784' '10822' '10858' '10906' '10915' '10929' '10935' '12005' '12006' '12007' '12010' '12215' '12328' '12360' '12413' '12512' '12648' '12651' '12707' '12727' '12739' '12750' '12815' '12898' '12899'};% ------------------------------------------------
6-
%subject_list = {'1106' '1108' '1132' '1134' '1154' '1160' '1173' '1174' '1179' '1190' '1838' '1839' '1874' '11013' '11051' '11056' '11098' '11106' '11198' '11220' '11244' '11293' '11325' '11354' '11369' '11375' '11515' '11560' '11580' '11667' '11721' '11723' '11750' '11852' '11896' '11898' '11913' '11927' '11958' '11965'}; %all the IDs for the indivual particpants
4+
clear all
5+
%subject_list = {'2202' '2204' '2207' '2212' '2216' '2222' '2229' '2231' '2243' '2256' '2257' '2261' '2267' '2270' '2274' '2281' '2284' '2286' '2292' '2295'};
6+
%subject_list = {'7003' '7007' '7019' '7025' '7046' '7049' '7051' '7054' '7058' '7059' '7061' '7064' '7065' '7073' '7075' '7078' '7089' '7092' '7094' '7123' '7556' '7808'};
7+
subject_list = {'10293' '10561' '10562' '10581' '10616' '10748' '10822' '10858' '10935' '12004' '12010' '12139' '12177' '12188' '12197' '12203' '12206' '12215' '12272' '12413' '12415' '12449' '12482' '12512' '12588' '12632' '12648' '12651' '12707' '12727' '12739' '12746' '12750' '12755' '12770' '12815' '12852' '12870'};
78
filename = 'restingstate'; % if your bdf file has a name besides the ID of the participant (e.g. oddball_paradigm)
8-
home_path = 'C:\Users\dohorsth\Desktop\Testing restingstate\Remaining_controls\'; %place data is (something like 'C:\data\')
9+
home_path = '\\data.einsteinmed.org\users\Filip Ana Douwe\Resting state data\'; %place data is (something like 'C:\data\')
910
blocks = 1; % the amount of BDF files. if different participant have different amounts of blocks, run those participant separate
1011
for s = 1:length(subject_list)
1112
clear ALLEEG
@@ -29,6 +30,7 @@
2930
end
3031
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 0,'setname', [subject_list{s} ' restingstate paradigm'],'gui','off'); %adds a name to the internal .set file
3132
%save the bdf as a .set file
32-
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '.set'],'filepath',data_path);
33+
mkdir( ['D:\restingstate\data\' subject_list{s}])
34+
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '.set'],'filepath',['D:\restingstate\data\' subject_list{s}]);
3335
end
3436

src/A_bdf_non_paradigm_merge_sets.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
% of a black screen)
66
% ------------------------------------------------
77
clear variables
8-
subject_list = {'10158' '10165' '10384' '10407' '10451' '10467' '10501' '10534' '10615' '10620' '10639' '10844' '10956' '10399' '12002' '12122'};
8+
subject_list = {'2260' '2201'};
99
%subject_list = {'1101' '1164' '1808' '1852' '1855' '11014' '11094' '11151' '11170' '11275' '11349' '11516' '11558' '11583' '11647' '11729' '11735' '11768' '11783' '11820' '11912'};
1010
filename = 'restingstate'; % if your bdf file has a name besides the ID of the participant (e.g. oddball_paradigm)
11-
home_path = 'C:\Users\dohorsth\Desktop\Testing restingstate\Remaining_controls\'; %place data is (something like 'C:\data\')
11+
home_path = '\\data.einsteinmed.org\users\Filip Ana Douwe\Resting state data\'; %place data is (something like 'C:\data\')
1212
wrongconfig = zeros(1,length(subject_list)); %there are 160channel files that have a wrong config file, this is to save them
1313
for s = 1:length(subject_list)
1414
clear ALLEEG
@@ -59,7 +59,8 @@
5959
EEG = eeg_checkset(EEG);
6060
end
6161
%save the bdf as a .set file
62-
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '.set'],'filepath',data_path);
62+
mkdir( ['D:\restingstate\data\' subject_list{s}])
63+
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '.set'],'filepath',['D:\restingstate\data\' subject_list{s}]);
6364
end
6465
save([home_path 'participants_with_wrong_config'], 'wrongconfig');
6566

src/B_preprocess1.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
EEG.event(i).time=EEG.event(i).latency/EEG.srate
9191
end
9292
EEG.event(length(EEG.event)+1)=EEG.event(length(EEG.event)); EEG.event(length(EEG.event)).type='temp';% EEG.event(length(EEG.event)).latency=EEG.event(length(EEG.event)).latency+100;EEG.event(length(EEG.event)).duration=EEG.event(length(EEG.event)).duration+100;
93+
9394
for i = length(EEG.event)-1:-1:1%12139 caused issue
9495
if strcmp(EEG.event(i).type, 'boundary') && strcmp(EEG.event(i+1).type, 'boundary') && EEG.event(i+1).latency/EEG.srate-EEG.event(i).latency/EEG.srate < 2 %following event is also a boundary and less then 2 seconds of "good" data between them
9596
disp(i)

src/D_preprocces2.m

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
logloc = dir([data_path '*.log']);
2424
if isempty(logloc)
2525
trigger_info = 'No triggers and no logfiles';
26-
clear logloc
2726
else
2827
trigger_info = 'No triggers but has logfile';
2928
clear logloc
3029
end
3130
%based on the raw data we decided that for these people we could place the triggers in the same place
32-
31+
if strcmp(subject_list{s},'placeholder')
32+
EEG = pop_importevent( EEG, 'event',[home_path 'trigger_info.txt'],'fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
33+
end
34+
if strcmp(subject_list{s},'7094')
35+
EEG = pop_importevent( EEG, 'event',[home_path 'trigger_info_early.txt'],'fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
36+
end
3337

3438

3539
%% looking and replacing wrong tiggers due to USB error
@@ -81,17 +85,28 @@
8185
end
8286
end
8387

84-
%% doing the final test to make sure everyone has trigger 50 and 51 (ignoring boundary)
88+
%doing the final test to make sure everyone has trigger 50 and 51 (ignoring boundary)
8589
final_triggers={EEG.event.type};
8690
for i=length(final_triggers):-1:1
8791
if strcmp(final_triggers(1,i),'boundary')
8892
final_triggers(i)=[];
8993
end
9094
end
91-
%we manually checked these people and they have a onset of alpha based on that they have specific onsets for the triggers. Later we will delete at least the first 10sec of data, this gives us a range, so mulitple people can use the same trigger time
92-
if strcmp(subject_list{s},'7094')
93-
EEG = pop_importevent( EEG, 'event',[home_path 'trigger_info_early.txt'],'fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
94-
elseif strcmp(subject_list{s}, '2204') || strcmp(subject_list{s}, '2207') || strcmp(subject_list{s}, '2231') || strcmp(subject_list{s}, '10748')
95+
%we manually checked these people and they have a onset of alpha
96+
% 7059 - very clearly at 186.5 - dont use this one (too few data)
97+
% 12512- at 227
98+
% 12215- maybe at 232 - dont use
99+
% 12272- 236
100+
% 2229 - 264,
101+
% 12755- not sure maybe at 246 - dont use
102+
% 2281 -282
103+
% 7092 -clear at 291 -
104+
% 2270 - maybe at 312 boundry? - dont use
105+
%7075 -no idication , also no events in previous files... - dont use
106+
%12413- no idea - dont use
107+
% alpha at 306 '2204' 2207 at 296 2231 at 302 - 10748 clear at 304 -
108+
% everyone that has between 295 and 305 %since we'll cut the first 10 sec we have a range
109+
if strcmp(subject_list{s}, '2204') || strcmp(subject_list{s}, '2207') || strcmp(subject_list{s}, '2231') || strcmp(subject_list{s}, '10748')
95110
EEG = pop_importevent( EEG, 'event',[home_path 'trigger_info.txt'],'fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
96111
final_triggers= {'added 50', 'added 51'};
97112
elseif strcmp(subject_list{s}, '12512') || strcmp(subject_list{s}, '12272')
@@ -103,11 +118,21 @@
103118
elseif strcmp(subject_list{s}, '2281') || strcmp(subject_list{s}, '7092')
104119
EEG = pop_importevent( EEG, 'event',[home_path 'trigger_info_282.txt'],'fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
105120
final_triggers= {'added 50', 'added 51'};
106-
% from here on out we should see nobody in the end with errors if so, either find out where the triggers should go, if not sure, don't use data
107121
elseif length(final_triggers) > 2
108122
final_triggers= {'error too ', 'many triggers'};
109123
elseif length(final_triggers) < 1
110124
final_triggers= {'error ', 'no triggers'};
125+
% logloc = dir([data_path '*.log']);
126+
% if isempty(logloc)
127+
% %No triggers and no logfiles
128+
% final_triggers= {'nothing', 'nothing'}
129+
% clear logloc
130+
% else
131+
% final_triggers= {'nothing', 'nothing'};%No triggers but has logfile
132+
% % EEG = pop_importevent( EEG, 'event',[home_path 'trigger_info.txt'],'fields',{'latency' 'type' 'position'},'skipline',1,'timeunit',1);
133+
% % final_triggers= {'added 50', 'added 51'};%No triggers but has logfile
134+
% clear logloc
135+
% end
111136
elseif strcmp(final_triggers(1),'condition 50') && length(final_triggers)==1
112137
final_triggers= {'has 50', 'missing 51'};
113138
if strcmp(subject_list{s}, '12177')
@@ -127,6 +152,3 @@
127152
end
128153
save([home_path 'participant_info'], 'participant_info');
129154

130-
%changed how it checks for bad triggers. Before it not delete all
131-
%boundaries only last one, now all and will see if there is anything but
132-
%condtion 51 and condtion 50

src/E_preprocces3.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,5 @@
140140
components(s,:) =[subj_comps];
141141
clear EEG_temp EEGinter
142142
end
143-
save([home_path 'components' ], 'components');
143+
save([home_path 'components' ], 'components');
144144
save([home_path 'deleted_data'], 'participant_data_qt');

0 commit comments

Comments
 (0)