Skip to content

Commit 3327747

Browse files
several fixes/updates
1 parent 75ea27f commit 3327747

File tree

9 files changed

+330
-218
lines changed

9 files changed

+330
-218
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Lastly this script uses eeglab's clean_artifacts function deletes the bad channe
9191
This script plots all the data in EEGlab as continues data and allows you to delete channels manually.
9292

9393
#### D_preprocces2
94-
This script will double check and fix any potential trigger issue we encountered. It saves a Matrix with the information for each individual participant.
94+
This script will double check and fix any potential trigger issue we encountered. It saves a Matrix with the information for each individual participant. **This script can be skipped** It is only useful for documenting triggers. We added the [pop_rejcont](https://github.com/wojzaremba/active-delays/blob/master/external_tools/eeglab11_0_4_3b/functions/popfunc/pop_rejcont.m) in the next script and this deletes triggers sometimes, so we need to double check triggers again (see [G_preprocces5](#g_preprocces5)).
9595

9696
#### E_preprocces3
9797
This script will do an average reference.
@@ -105,16 +105,22 @@ After that we use [pop_rejcont](https://github.com/wojzaremba/active-delays/blob
105105
This script loads a file with all the original channels, deletes the externals and uses these file locations to interpolate the channels of the corresponding's subjects data.
106106
In the case of 160 channel data, it uses the [transform_n_channels](https://github.com/CognitiveNeuroLab/Interpolating_160ch_to_64ch_eeglab) function to interpolate the remaining channels not to the original 160, but to 64 channel data so that it is the same as all the other data. For this to work Matlab needs to know the location of 2 things, the trannsform_n_channel.m file and the EEG files called 64.set and 64.fdt.
107107

108+
#### G_preprocces5
109+
In this script, we first make sure that the triggers are still in the right place. Due to the extra cleaning we did with the pop_rejcont function in [E_preprocces3](#e_preprocces3) it is possible that the triggers got deleted if the corresponding continues data were too noisy. If they got deleted, the scripts calculates what the time of the onset of that deleted part of data was and uses that instead as the latency of the trigger.
110+
108111
### Power Frequency Analysis
109-
In the G_PSD_pwelsh script, we first make sure that the triggers are still in the right place. Due to the extra cleaning we did with the pop_rejcont function in [E_preprocces3](#e_preprocces3) it is possible that the triggers got deleted if the corresponding continues data were too noisy. If they got deleted, the scripts calculates what the time of the onset of that deleted part of data was and uses that instead as the latency of the trigger.
112+
110113

111114
After that we use the the [pwelch function of Matlab](https://www.mathworks.com/help/signal/ref/pwelch.html) and a log tranformation of the results to get the power frequency results.
112115

113116
# add here what channels we use, for now it's just indivual but we will change this to groups and averages of those groups
114117

115-
### Microstates
118+
### Microstates Groups & all
116119
this script follows the code as descibed in Poulsen, A. T., Pedroni, A., Langer, N., & Hansen, L. K. (2018). Microstate EEGlab toolbox: An introductory guide. [See their guide in bioRxiv for more information.](https://www.biorxiv.org/content/10.1101/289850v1)
117120

121+
In the first part the analysis only focuses on the group level. Since we use both eyes open and eyes closed data, we want to check how many microstates are suggested for both, so we can choose the best (same) amount for both. In the case of patient/control group we would need to compare all 4 the suggestions. Running the whole script would take a lot of time that wasn't needed.
122+
123+
The second script will do everything again (since now you know how many microstates you want) and backfits it on the individual EEGs. Giving both plots per subject and adds data to the EEG structure to do stats on.
118124

119125

120126
## License

src/E_preprocces3.m

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
clear variables
22
eeglab
3-
Group = {'Aging' 'Control' 'ASD'}; %'Control'
3+
Group = { 'ASD' 'Control' 'Aging'}; %
44

55
for g=1:length(Group)
66
switch Group{g}
77
case 'Control'
8-
home_path = '\\data.einsteinmed.org\users\Filip Ana Douwe\Resting state data\Control\';
8+
home_path = 'C:\Users\dohorsth\Desktop\Testing restingstate\Control\';
99
subject_list = {'12512' '12648' '12651' '12707' '12727' '12739' '12750' '12815' '12898' '12899' '10033' '10130' '10131' '10158' '10165' '10257' '10281' '10293' '10360' '10369' '10384' '10394' '10407' '10438' '10446' '10451' '10463' '10467' '10476' '10501' '10526' '10534' '10545' '10561' '10562' '10581' '10585' '10616' '10615' '10620' '10639' '10748' '10780' '10784' '10822' '10858' '10906' '10915' '10929' '10935' '10844' '10956' '12005' '12007' '12010' '12215' '12328' '12360' '12413' };% ------------------------------------------------
1010
case 'ASD'
1111
home_path = 'C:\Users\dohorsth\Desktop\Testing restingstate\ASD\';
@@ -25,7 +25,7 @@
2525
% Path to the folder containing the current subject's data
2626
data_path = [home_path subject_list{s} '\\'];
2727
fprintf('\n\n\n**** %s: Loading dataset ****\n\n\n', subject_list{s});
28-
EEG = pop_loadset('filename', [subject_list{s} '_triggerfix.set'], 'filepath', data_path);
28+
EEG = pop_loadset('filename', [subject_list{s} '_triggerfix.set'], 'filepath', data_path);
2929
%re-referencing, if refchan is empty this get's skipped
3030
if isempty(refchan)~=1 %if no re-reference channels chose this gets skipped
3131
for j=1:length(EEG.chanlocs)
@@ -64,7 +64,6 @@
6464
EEG = pop_runica(EEG, 'extended',1,'interupt','on','pca',pca); %using runica function, with the PCA part
6565
EEG = eeg_checkset( EEG );
6666
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '_ica.set'],'filepath', data_path);
67-
6867
%organizing components
6968
clear bad_components brain_ic muscle_ic eye_ic hearth_ic line_noise_ic channel_ic other_ic
7069
EEG = iclabel(EEG); %does ICLable function
@@ -92,9 +91,7 @@
9291
EEG = pop_subcomp( EEG, [bad_components], 0); %excluding the bad components
9392
close all
9493
else %instead of only plotting bad components it will plot all components
95-
title(subject_list{s}); text( 0.2,0.5, 'there are no eye-components found')
96-
pop_topoplot(EEG, 0, 1:length(ICA_components) ,subject_list{s},[ceil(sqrt(length(ICA_components))) ceil(sqrt(length(ICA_components)))] ,0,'electrodes','on');
97-
title(subject_list{s});
94+
title(subject_list{s}); text( 0.2,0.5, 'there are no eye-components found')
9895
print([figure_path subject_list{s} '_Bad_ICs_topos'], '-dpng' ,'-r300');
9996
end
10097
title(subject_list{s});

src/F_preprocces4.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
clear variables
66
eeglab
77
close all
8-
Group = {'Aging' 'ASD'};%'Control'
8+
Group = {'ASD'};%'Control'
99
name_paradigm = 'restingstate'; % this is needed for saving the table at the end
1010
for g=1:length(Group)
1111
switch Group{g}
1212
case 'Control'
13-
home_path = '\\data.einsteinmed.org\users\Filip Ana Douwe\Resting state data\Control\';
13+
home_path = 'C:\Users\dohorsth\Desktop\Testing restingstate\Control\';
1414
subject_list = {'12512' '12648' '12651' '12707' '12727' '12739' '12750' '12815' '12898' '12899' '10033' '10130' '10131' '10158' '10165' '10257' '10281' '10293' '10360' '10369' '10384' '10394' '10407' '10438' '10446' '10451' '10463' '10467' '10476' '10501' '10526' '10534' '10545' '10561' '10562' '10581' '10585' '10616' '10615' '10620' '10639' '10748' '10780' '10784' '10822' '10858' '10906' '10915' '10929' '10935' '10844' '10956' '12005' '12007' '12010' '12215' '12328' '12360' '12413' };% ------------------------------------------------
1515
case 'ASD'
1616
home_path = 'C:\Users\dohorsth\Desktop\Testing restingstate\ASD\';

0 commit comments

Comments
 (0)