Programs for

Muscle synergy analysis yields an efficient and physiologically relevant way of assessing stroke

Tetsuro Funato, Noriaki Hattori, Arito Yozu, Qi An, Tomomichi Oya, Shouhei Shirafuji, Akihiro Jino, Kyoichi Miura, Giovanni Martino, Denise Berger, Ichiro Miyai, Jun Ota, Yury Ivanenko, Andrea d'Avella, and Kazuhiko Seki

Files


Note: Place "measuredMat" folder in the "sampleMeasuredFiles.zip" to the same folder with program files
("analysis1_synergyExtraction.m" and "analysis2_analysisUsingStadardSynergies.m").

Measured data include one trial data of one healthy subject.


Structure of the sample data files

  • measuredMat/[trial].mat
    mName: Names of Measured Muscles
    mFreq:
    Measurement Frequency
    mData:
    Measured EMG data (42ch). Data in first column are time, and data in each column from second column are time series of EMG data measured from one muscle. The order of muscles are same with the order of muscle names in mName.

  • measuredMat//taskTime/[trial].csv Initial and end time of each task item
    First column: task number
    Second column: initial time of the task (MMSS; first two digits represent 'minite' and last two digits represent 'seconds')

    Third column: end time of the task (MMSS; first two digits represent 'minite' and last two digits represent 'seconds')

Discritption of the programs

analysis1_synergyExtraction.m

Extraction of muscle synergies from measured EMG data

Usage

1: Calculate VAF using [1,3: Synergy Analysis] function with [calcVAF=1, calcSynergyAll=0]

2: Determine the number of synergies using [2: Evaluation of VAF] functions

3: Calucate Synergies using [1,3: Synergy Analysis] function with [calcVAF=0, calcSynergyAll=1]


1,3: Synergy Analysis function

  • Calculation of VAF and calculation of Synergies
    MATLAB File: analysisEMG.m
    [Common Input/Output files]
    Input: measuredMat/[trial].mat Measured EMG data (mData) and Name of Muscles (mName)
    measuredMat//taskTime/[trial].csv Initial and end time of each task item
    Output: resultMat/[Healthy or Stroke]/dataOrig_[trial].mat Measured data after pre-processing
    dur[Healthy or Stroke].csv Duration of each task item
    [Input/Output files for 1: calcVAF=1]
    Output: resultMat/vafAll_[trial].mat
    [Input/Output files/Output Figures for 3: calcSynergyAll=1]
    Input: resultMat/[Healthy or Stroke]/VAF[VAFThreshold]/synergyNum_VAF[VAFThreshold].mat Number of synergies (pcNum) calculated by [2: Evaluation of VAF]
    Output: zAll_[trial]_pcNum[pcNum]_VAF[VAFThreshold].mat Muscle synergies
    vAll_[trial]_pcNum[pcNum]_VAF[VAFThreshold].mat Temporal coefficient of muscle synergies
    Output Figures: resultFigs/[trial]/emgAnalysis_[Indx].eps


2: Evaluation of VAF

  • Number of synergies is saved to the file: synergyNum_VAF[VAFThreshold].mat
    MATLAB File: evalVAF.m
    [Input/Output files]
    Input: measuredMat/[trial].mat Measured EMG data (mData) and Name of Muscles (mName)
    Output: resultMat/[Healthy or Stroke]/VAF[VAFThreshold]/synergyNum_VAF[VAFThreshold].mat
    Output Figures: resultFigs/Healthy/vafAll_subAll.eps VAF of all subjects (Healthy)
    resultFigs/Stroke/vafAll_S[subject number].eps VAF of stroke patients (Stroke)

analysis2_analysisUsingStadardSynergies.m

Analyes performed by this program:

  • Evaluation of standard synergies (1-3)

  • Merging of Stroke Synergies (4-5)

  • Severity-merging rate relationship (6)

Usage

Run following programs sequentially by setting their option=1.


1: Calculation of Standard Synergies (synergyGroup.mat) / Draw Fig. 1B, Supplementary Table 3

  • Calculatoin of Standard Synergies (calcStandardSynergies = 1)
    MATLAB File: P1A_calcStandardSynergies.m
    [Input/Output files]
    Input: zAll_[trial]_pcNum[pcNum]_VAF[VAFThreshold].mat (Synergy of healthy particiapants)
    Output: synergyGroup.mat (Standard synergies)
    Output Figures: synergyShare[num]_VAF[VAFThreshold].eps (Standard synergies, Fig. 1B)

  • Evaluate Standard Synergies from muscle area (evalResultsSynEMG=1)
    MATLAB File: P1B_evalStandardSynergyFromMuscles
    [Input/Output files]
    Input : synergyGroup.mat
    Output: majorEMGListChOrder_th[threashold].xlsx (Supplementary Table 3)


2: Calculation of temporal coefficient of Healthy/Stroke EMG data corresponding to standard synergies

  • MATLAB File: P2_calcTCoeff.m
    [Input/Output files]
    Input: synergyGroup.mat
    dataOrig_[trial].mat (EMG file)
    Output: wTild_[trial].mat (wTild:temporal coefficient corresponding to standard synergies)


3: Calculate Synergy-Task relationship (Fig. 2)

  • MATLAB File: P3_calcTaskSynergyRelationship.m
    [Input/Output files]
    Input: wTilde_[trial].mat
    Output: tSynergyTaskList.csv (Healthy) [temporal coeff corresponding to standard synergy is used for evaluation]
    tSynergyTaskList_tNum[trial].csv (Stroke) [temporal coeff corresponding to standard synergy is used for evaluation]
    tSynergyTaskMildList_tNum[trial].csv (Stroke)
    tSynergyTaskSevereList_tNum[trial].csv (Stroke)
    Output Figures: synergy-taskTable_VAF[VAFThreshold].eps (Healthy) Fig.2A
    synergy-taskTable_Mild_tNum[trial]_VAF[VAFThreshold].eps (Stroke) Supplementary Fig. 4
    synergy-taskTable_Severe_tNum[trial]_VAF[VAFThreshold].eps (Stroke) Supplementary Fig. 4
    synergy-taskTable_MildDiff_tNum[trial]_VAF[VAFThreshold].eps (Stroke) Fig.2B
    synergy-taskTable_SevereDiff_tNum[trial]_VAF[VAFThreshold].eps (Stroke) Fig.2B
    Note: Caltulate Healthy using anaProp.tHNum = 0; (Standard Synergy is calculated for all trials)
    Caltulate Stroke using anaProp.tHNum = 1 or 2;


4: Calculate Standard Synergy-Stroke Synergy Table (Fig. 3A)

  • MATLAB File: P4_evalCompStandardStroke.m
    [Input/Output files]
    Input: synergyGroup.mat
    zAll_[trial]_pcNum[pcNum]_VAF[VAFThreshold].mat (Synergy of healthy particiapants)
    Output: corrStandardStroke[trial].mat


5: Calulates number of merging stroke synergies (Fig. 3B)

  • Calcluate merging relationship
    MATLAB File: P5A_evalMerging.m
    [Input/Output files]
    Input: synergyGroup.mat
    Output: mergingList_[trial]_VAF[VAFThreshod]_mTh[mergingThreshold].mat (used P5B_summaryMerging.m)
    Note: Use this function with anaProp.tHNum = anaProp.tSNum =0

  • Plot and test results of merging synergies
    MATLAB File: P5B_summaryMerging.m
    [Input/Output files]
    Input: mergingList_[trial]_VAF[VAFThreshod]_mTh[mergingThreshold].mat
    Output Figures: numMerging_mTh[mergingThreshold]_tSNum[trial].eps (Fig.3B)
    mergingBarsMS_mTh[mergingThreshold]_tHNum[trial]_tSNum[trial]_box.eps (Fig.3B)


6: Calculate Severity-merging rate relationship for each task (Fig. 4AB)

  • Calculate Synergy-Task relationship of stroke synergies
    MATLAB File: P6A_calcTaskStrokeSynergyRelation.m
    Input vAll_[trial]_pcNum[pcNum]_VAF[VAFThreshold].mat
    Output: tSynergyTaskList2_[trial].csv (Healthy) [temporal coeff corresponding to stroke synergy is used for evaluation]


  • Calculate number of merging for each task
    MATLAB File: P6B_evalMergingTask.m
    Input: synergyGroup.mat
    zAll_[trial]_pcNum[pcNum]_VAF[VAFThreshold].mat (Synergy of healthy particiapants)
    tSynergyTaskList2_[trial].csv
    Output: mergeRateTask_mTh[mergingThreshold]_tNum[trial].mat
    mergeRateTask_mTh[mergingThreshold]_tNum[trial].xlsx
    Output Figures: mergeRateTask_mTh[mergingThreshold]_tNum[trial].eps (Fig. 4A)


  • Plot p-value list of severity-merge rate relationship for each task
    MATLAB File: P6C_summaryMergingTask
    Input: mergeRateTask_mTh[mergingThreshold]_tNum[trial].mat
    Output Figures: impTaskMergingCVal_mTh[mergingThreshold]_tNum[trial]_VAF[VAFThreshold].eps
    impTaskMergingPVal_mTh[mergingThreshold]_tNum[trial]_VAF[VAFThreshold].eps (Fig. 4B)

Required Programs

Following third party matlab functions are required for drawing figures

Following third party matlab functions are required for statistical analysis