|
9 | 9 | % ------------------------------------------------ |
10 | 10 | clear variables |
11 | 11 | eeglab |
12 | | -group = {'Control' '22q' 'schiz'};% |
| 12 | +group = { 'Control' '22q' 'schiz'};% |
13 | 13 | lowpass_filter_hz=50; %50hz filter |
14 | 14 | highpass_filter_hz=1; %1hz filter |
15 | | -script_location= 'C:\Users\dohorsth\Documents\GitHub\resting-state-analysis-pipeline-microstates-frequency\src\'; |
| 15 | +script_location= 'D:\restingstate\scripts\'; |
| 16 | + |
16 | 17 | for g=1:length(group) |
17 | 18 | if strcmp(group{g},'22q') |
18 | | - subject_list = {'1101' '1164' '1808' '1852' '1855' '11014' '11094' '11151' '11170' '11275' '11349' '11516' '11558' '11583' '11647' '11729' '11735' '11768' '11783' '11820' '11912' '1106' '1108' '1132' '1134' '1154' '1160' '1173' '1174' '1179' '1190' '1838' '1839' '1874' '11013' '11056' '11098' '11106' '11198' '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 |
19 | | - home_path = 'D:\Data\'; |
| 19 | + subject_list = {'2201' '2202' '2204' '2207' '2212' '2216' '2222' '2229' '2231' '2243' '2256' '2257' '2260' '2261' '2267' '2270' '2274' '2281' '2284' '2286' '2292' '2295'}; |
| 20 | + home_path = 'D:\restingstate\data\'; |
20 | 21 | elseif strcmp(group{g},'schiz') |
21 | | - subject_list = {'12022' '12023' '12031' '12081' '12094' '12188' '12255' '12335' '12339' '12362' '12364' '12372' '12376' '12390' '12398' '12407' '12408' '12451' '12454' '12457' '12458' '12459' '12468' '12478' '12498' '12510' '12517' '12532' '12564' '12631' '12633' '12634' '12636' '12665' '12670' '12696' '12719' '12724' '12751' '12763' '12769' '12776' '12790' '12806' '12814' '12823' '12830' '12847' '12851' '12855' '12856' '12857' '12859' '12871' '12872' '12892'}; |
22 | | - home_path = 'D:\Data\'; |
| 22 | + subject_list = {'7003' '7007' '7019' '7025' '7046' '7049' '7051' '7054' '7058' '7059' '7061' '7064' '7065' '7073' '7075' '7078' '7089' '7092' '7094' '7123' '7556' '7808'}; |
| 23 | + home_path = 'D:\restingstate\data\'; |
23 | 24 | elseif strcmp(group{g},'Control') |
24 | | - subject_list = {'10281'};%'10158' '10165' '10384' '10407' '10451' '10467' '10501' '10534' '10615' '10620' '10639' '10844' '10956' '10033' '10130' '10131' '10257' '10281' '10293' '10360' '10369' '10394' '10438' '10446' '10463' '10476' '10526' '10545' '10561' '10562' '10581' '10585' '10616' '10748' '10780' '10784' '10822' '10858' '10906' '10915' '10929' '10935' '12005' '12007' '12010' '12215' '12328' '12360' '12413' '12512' '12648' '12651' '12707' '12727' '12739' '12750' '12815' '12898' '12899'};% ------------------------------------------------ |
25 | | - home_path = 'C:\Users\dohorsth\Desktop\practice\';%'C:\Users\dohorsth\Desktop\Testing restingstate\Remaining_controls\'; |
| 25 | + 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'}; |
| 26 | + home_path = 'D:\restingstate\data\'; |
26 | 27 | end |
27 | 28 | deleted_channels=zeros(length(subject_list),2); |
28 | 29 | deleted_data=zeros(length(subject_list),2); |
|
77 | 78 | % components in ICA or if these are pre-deleted now (which they shouldn't) |
78 | 79 | %EEG = pop_clean_rawdata(EEG, |
79 | 80 | %'FlatlineCriterion',5,'ChannelCriterion',0.8,'LineNoiseCriterion',4,'Highpass','off','BurstCriterion','off','WindowCriterion','off','BurstRejection','off','Distance','Euclidian');%doesn't delete bad periods |
80 | | - EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion',5,'ChannelCriterion',0.8,'LineNoiseCriterion',4,'Highpass','off','BurstCriterion',20,'WindowCriterion','off','BurstRejection','on','Distance','Euclidian'); % deletes bad chns and bad periods |
| 81 | + %first at 'BurstCriterion',20, this caused too much data to be |
| 82 | + %deleted, second time at 'BurstCriterion',50, this caused too few data to be |
| 83 | + EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion',5,'ChannelCriterion',0.8,'LineNoiseCriterion',4,'Highpass','off','BurstCriterion',35,'WindowCriterion','off','BurstRejection','on','Distance','Euclidian'); % deletes bad chns and bad periods |
81 | 84 | EEG.deleteddata_wboundries=100-EEG.pnts/old_samples*100; |
82 | 85 | new_n_chan = EEG.nbchan; |
83 | 86 | deleted_sample=EEG.pnts; |
84 | | - for i = length(EEG.event)-1:-1:1 |
85 | | - 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 |
86 | | - disp(i) |
87 | | - EEG = pop_select( EEG, 'notime',[EEG.event(i).latency/EEG.srate EEG.event(i+1).latency/EEG.srate] ); |
| 87 | + if ~isempty(EEG.event) %at least 1 participant with no events |
| 88 | + %adding one boundary at the end to stop issues, will delete later |
| 89 | + for i=1:length(EEG.event) |
| 90 | + EEG.event(i).time=EEG.event(i).latency/EEG.srate |
88 | 91 | end |
| 92 | + 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 | + |
| 94 | + for i = length(EEG.event)-1:-1:1%12139 caused issue |
| 95 | + 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 |
| 96 | + disp(i) |
| 97 | + EEG = pop_select( EEG, 'notime',[EEG.event(i).latency/EEG.srate EEG.event(i+1).latency/EEG.srate] ); |
| 98 | + if strcmp(EEG.event(length(EEG.event)).type, 'boundary') |
| 99 | + EEG.event(length(EEG.event)+1)=EEG.event(length(EEG.event)); EEG.event(length(EEG.event)).type='temp'; |
| 100 | + end |
| 101 | + end |
| 102 | + end |
| 103 | + EEG.event(length(EEG.event)) = []; |
89 | 104 | end |
| 105 | + % deleting the event we added before |
90 | 106 | new_samples=EEG.pnts; |
91 | 107 | EEG.deleteddata=100-EEG.pnts/old_samples*100; |
92 | 108 | deleted_channels(s,:) = [string(subject_list{s}), old_n_chan-new_n_chan] ; |
|
0 commit comments