Skip to content

Commit 1924c13

Browse files
author
Schumer
committed
2026/04/29 - update eegERP FishSharks section
1 parent 36248d2 commit 1924c13

1 file changed

Lines changed: 29 additions & 79 deletions

File tree

eegERP.qmd

Lines changed: 29 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ Note: The Oddball and Fish-Shark scripts include lines to add necessary file pat
5656

5757
The following section describes the MATLAB scripts used to manage HAPPE output files for the Oddball task data. If you are running HAPPE manually (i.e., without integrating these scripts), skip to the [Oddball HAPPE inputs](#sec-inputOddballHAPPE) section.
5858

59-
1. Open the `eegProccessingOddball.m` file (accessible via Git [here](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-DataProcessing/-/blob/master/6.%20MATLAB%20EEG%20Pipeline/eegProcessingOddball.m)) in MATLAB
59+
1. Open the `eegProccessingOddball.m` file (accessible via Git [here](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-DataProcessing/-/blob/master/6.%20MATLAB%20EEG%20Pipeline/eegProcessingOddball.m)) in MATLAB.
6060
1. Click "Run" on the MATLAB editor window with the script open.
6161
1. Input the requested information in the Command Window at the bottom of the MATLAB screen.
6262

6363
- All inputs are case sensitive.
6464
- Do not put quotes around any inputs.
6565

66-
1. SRS-ERP-Oddball Repository: the local path to the [Oddball processing repo](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-ERP-Oddball)
66+
1. SRS-ERP-Oddball Repository: the local path to the [Oddball processing repository](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-ERP-Oddball)
6767
1. HAPPE Pre-Processing File: the **full** file path to HAPPE_v4.m
68-
- Within the HAPPE folder, this file is in the `1. pre-process` folder, so the full path should be similar to `Documents/GitHub/HAPPE/1. pre-process/HAPPE_v4.m`
68+
- Within the HAPPE folder, this file is in the `1. pre-process` folder, so the full path should be similar to `C:/Users/hawkid/Documents/GitHub/HAPPE/1. pre-process/HAPPE_v4.m`
6969
1. HAPPE Threshold: "Hard" for hard threshold (preferred) or "Soft" for soft threshold
70-
- **Case-sensitive**--first letter must be capitalized.
70+
- **Case sensitive**--first letter must be capitalized.
7171
- Do not include quotation marks.
7272
- The soft threshold is less strict with artifact removal, and the hard threshold is more strict.
7373
1. Trial Cutoff: the minimum number of trials that need to be retained after processing for a particular recording to be eligible for PCA (default is 10)
@@ -417,7 +417,7 @@ These actions will take place automatically upon completion of the HAPPE pipelin
417417

418418
## FishShark Processing Pipeline
419419

420-
### Recommended Folder Strucure
420+
### Folder Strucure
421421

422422
1. `0 - Raw`
423423
1. `1a - Files for HAPPE`
@@ -435,67 +435,33 @@ The following section describes the MATLAB scripts used to manage HAPPE input an
435435
**The first two steps described in this section are the same as those described for Oddball processing.**
436436
**Processing actions specific to FishSharks task begin in Step 3.**
437437

438-
1. Open the `eegProccessingFishshark.m` file (accessible via Git [here](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-DataProcessing/-/blob/master/6.%20MATLAB%20EEG%20Pipeline/eegProcessingFishshark.m)) in MATLAB
439-
1. Update all thresholds and filepaths in script file (must be done BEFORE running the script)
440-
- In the fifth section of our script file, we set our "threshold" for the minimum number of trials that need to be retained after pre-processing for a subject's data to be eligible for PCA.
441-
Additional thresholds can also be set for things like number of channels retained, but these are not currently in use.
442-
- Note that setting these parameters occurs later in the FishSharks script than the one for Oddball;
443-
this is because FishSharks files require additional processing before they are ready for HAPPE (see step 3 for details)
438+
1. Open the `eegProccessingFishshark.m` file (accessible via Git [here](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-DataProcessing/-/blob/master/6.%20MATLAB%20EEG%20Pipeline/eegProcessingFishshark.m)) in MATLAB.
439+
1. Click "Run" on the MATLAB editor window with the script open.
440+
1. Input the requested information in the Command Window at the bottom of the MATLAB screen.
441+
442+
- All inputs are case sensitive.
443+
- Do not put quotes around any inputs.
444444

445-
```
446-
% Set quality threshold parameters
447-
trialCutoff = 10;
448-
```
449-
- We also set environment variables with all of the filepaths that are relevant for managing HAPPE output files and tracking processed data.
450-
The following paths should be checked and updated as necessary to reflect the organization of processing on your computer.
451-
- `passPath` is the location you wish to have files that meet or exceed the above-defined thresholds to be saved
452-
- `allPath` is the location you wish to have ALL files outputted from HAPPE saved to (regardless of whether threshold is met or not)
453-
- `failPath` is the location you wish to have files that do not meet the above-defined thresholds to be copied to
454-
- .mff files that do not meet threshold will be copied here as an indication that they should be processed manually to see if they meet threshold afterward
455-
- `summPath` is the location you wish to save the file that lists all files processed through HAPPE in the current batch
456-
- We currently use this to save the "processing log" to a location that all team members/computers have access to so it is easier to determine which files require processing when EEG data are not stored on a shared server
457-
- `manPath` is the location you wish to save the file that lists all files that do not meet the above-defined thresholds
458-
- We currently use this to save the "to process manually" list to a location that all team members/computers have access to so it is easier to determine which files require manual processing because the copied .mff file would not be acessible via our shared server
459-
460-
```
461-
% Set paths for file sorting
462-
passPath = 'V:\Processing-Repo\Folder Structure\3 - Files for PCA'; %location for .txt output files
463-
allPath = 'V:\Processing-Repo\Folder Structure\2 - Processed Files'; %location for all processed files to end up
464-
failPath = 'V:\Processing-Repo\Folder Structure\1b - Manual Processing'; %location to copy unsuccessful .mff to for manual process
465-
466-
% Set path for processing summary
467-
summPath = 'Z:\Shared Server\Study Folder\Data Processing\6. MATLAB EEG Pipeline\Processed Data Logs';
468-
469-
% Set path for summary of files to process manually
470-
manPath = 'Z:\Shared Server\Study Folder\Data Processing\6. MATLAB EEG Pipeline\Processing To Do\Cases to Process Manually\Lists of Cases by Batch';
471-
```
472-
1. Update raw (.mff) files' condition tags with accuracy information
445+
1. Raw Files: the full path to the folder containing the raw data files
446+
1. Updated Files: the full path to the folder to store the data files after accuracy coding (folder must exist before running script)
447+
1. SRS-ERP-FishSharks Repository: the local path to the [Fish-Sharks processing repository](https://research-git.uiowa.edu/PetersenLab/SRS/SRS-ERP-FishSharks)
448+
1. HAPPE Pre-Processing File: the **full** file path to HAPPE_v4.m
449+
- Within the HAPPE folder, this file is in the `1. pre-process` folder, so the full path should be similar to `C:/Users/hawkid/Documents/GitHub/HAPPE/1. pre-process/HAPPE_v4.m`
450+
1. HAPPE Threshold: "Hard" for hard threshold (preferred) or "Soft" for soft threshold
451+
- **Case sensitive##--first letter must be capitalized.
452+
- Do not include quotation marks.
453+
- The soft threshold is less strict with artifact removal, and the hard threshold is more strict.
454+
1. Trial Cutoff: the minimum number of trials that need to be retained after processing for a particular recording to be eligible for PCA (default is 10)
455+
456+
1. Update raw (.mff) files' condition tags with accuracy information.
473457
- Unlike the Passive Oddball task, FishSharks trials can be either correct or incorrect.
474458
Whether or not a trial was "responded to" correctly is relevant to the nature of the extracted ERP.
475459
Because the event tags in our .mff files do not inherently contain information about whether each trial was responded to correctly, we need to add it ourselves.
476460
This process can be done manually in NetStation, but it can also be automated using the MATLAB code detailed below.
477-
- NOTE: This code requires eeglab.
478-
**Before running the code, open eeglab in your MATLAB session by typing `eeglab` into the console.**
479-
You can close it as soon as it opens, but this step ensures that eeglab is loaded into your current session and helps prevent the subsequent code from erroring out.
480-
481-
1. Set the filepaths for raw and updated .mff files
482-
- This section is set to rely on user inputs.
483-
Click "Run" in the MATLAB editor to start the processing.
484-
- A message will appear in the console prompting you to enter two filepaths:
485-
the first is the location of the raw .mff files, and the second is the location you would like the updated files to save in.
486-
- **Note: the filepaths inputted should NOT be in quotes**
487-
488-
```
489-
% User input for location of raw files
490-
pathRaw = input('Enter the full path to the folder containing the raw files:\n> ','s');
491-
492-
% User input for destination of subsetted files
493-
pathSub = input('Enter the full path to the folder in which to save the updated files:\n> ','s');
494-
```
495-
At this point, there will be no user input/actions necessary until all of the .mff files in the `pathRaw` directory have been updated and saved into the `pathSub` directory.
496-
The code that asks the user for the path to HAPPE will run when that process has finished.
497-
The following section will describe the code used to automate the process of updating .mff event tags to include accuracy information at the trial level.
498-
Move on to Step 4 (Run the HAPPE Pipeline) when the process has completed.
461+
At this point, there will be no user input/actions necessary until all of the .mff files in the Raw Files directory have been updated and saved into the Updated Files directory provided in the previous step.
462+
This part of the script may take a few minutes to run.
463+
The following section will describe the code used to automate the process of updating .mff event tags to include accuracy information at the trial level.
464+
Move on to Step 4 (Run the HAPPE Pipeline) when the process has completed.
499465

500466
1. Gather and manage information from the directory housing the raw (.mff) files
501467

@@ -508,7 +474,7 @@ The following section describes the MATLAB scripts used to manage HAPPE input an
508474
dirInfo(noName, :) = [];
509475
```
510476
1. Generate variables necessary for managing raw and updated files
511-
- This code will generate the full filepaths (including file name) necessary for reading in each .mff file and saving its updated counterpart
477+
- This code will generate the full file paths (including file name) necessary for reading in each .mff file and saving its updated counterpart
512478
- It will also generate an ID variable for joining purposes based on the expected location of the subject name in the name of each file
513479
514480
```
@@ -641,23 +607,7 @@ The following section describes the MATLAB scripts used to manage HAPPE input an
641607
pop_mffexport(EEGraw, char(subFolder))
642608
end
643609
```
644-
645-
646-
1. Run the HAPPE Pipeline
647-
- This section is designed to rely on user input.
648-
- When the prior steps have finsihed, a message will appear in the console prompting you to enter the filepath to the location of the HAPPE pre-processing file you wish to run
649-
- Once the path is entered, MATLAB will run the file
650-
- **Note: the filepath inputted should NOT be in quotes**
651-
652-
```
653-
% Set path to HAPPE pre-processing script
654-
happeRun = input('Enter the full path to the HAPPE pre-processing file:\n> ','s') ;
655-
656-
% Call and run HAPPE pre-processing script
657-
run(happeRun);
658-
```
659-
1. Enter HAPPE inputs
660-
- See the following section for HAPPE inputs for the Fish/Shark task
610+
1. Enter HAPPE inputs.
661611
662612
After the HAPPE inputs are entered, no more user interaction is required for the script to do its job.
663613
The HAPPE pipeline will run, and the remaining MATLAB code in the script file will evaluate the files outputted by HAPPE and move them to the appropriate locations based on this evaluation.

0 commit comments

Comments
 (0)