Export graph metric values

Home Forums General Help (Braph 2.0) Export graph metric values

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #172555
    Sai Prasanna
    Participant

    Hi,
    When I run the Functional analysis pipeline, is there anyway I can obtain the graph metrics values for individual subject and not just the group average. I need these values subject-wise and store them in a xls file.

    Thanks.
    Sai Prasanna

    #173018

    Dear Sai Prasanna,

    The export to XLS file in the GUI is made on the group average results. Nevertheless, we keep the results for each subject. To obtain those, you will need to create your own script. Use ‘example_FUN_WU’ as a base, which is located in the Functional folder inside pipelines, and after calculating the analysis use the following line of code:

    ms1 = cellfun(@(x) x.getMeasure(measure_class).memorize('M'), analysis.memorize('G_DICT').getItems, 'UniformOutput', false);

    measure_class is the type of measure you want, for example, ‘Degree’.

    Best regards,
    Emiliano and Anna

    #173060
    Sai Prasanna
    Participant

    Thanks. I will try that.

    Also, the GUI is giving me an option of exporting the results as a JSON file only. Could you please let me know how I can save the group average results into an XLS file ?

    #173076
    Sai Prasanna
    Participant

    I’m trying to use the example_FUN_BUD as you mentioned. I need to calculate all the graph metrics. The example file mentions 2-3 metrics. Do I use similar methods for all other metrics ?

    I would appreciate your guidance on saving the individual subject correlation matrices as well.

    #173528
    1. You can export the results to XLS if you right-click on the top of the table that is visualized by pressing Data Selected Measures or Data Selected Comparison:
      Export average results to XLS

      Check Figure 11 and Figure 14 in this tutorial to see what I mean by going to Data Selected Measures or Data Selected Comparison: http://braph.org/tutorials/pipelines/pipeline-functional-comparison-bud/

    2. You can add as many metrics as you want, just change the name of the Measure in the measure_class field. The example file is to show how to calculate them using a script and not the GUI. So you can modify it as you need.
    3. To save the individual subject correlation matrices it is better to do it as well via script. Still, it is possible in the GUI if you press the IndexedDictionary button in the GRAPHS section in analysis.
      Individual matrices export to XLS
    #173791
    Sai Prasanna
    Participant

    Thanks for your responses.
    Sorry, if I’m asking too many questions.

    1. I just tried as you mentioned. However, after running my script for calculating the analysis,

    ms1 = cellfun(@(x) x.getMeasure(‘Degree’).memorize(‘M’), analysis.memorize(‘G_DICT’).getItems, ‘UniformOutput’, false)

    gives me an error that says, “Unable to resolve the name analysis.memorize.”
    I must be doing something wrong.

    1. I have 200+ subjects. Saving individual correlation matrices through GUI would be a tedious process. How can I save them as separate .xls files for each subject through custom script?
    #173810
    Yu-Wei Chang
    Moderator

    Hi Sai Prasanna,

    Thanks for the follow-up feedback.
    I would like to provide further information based on example_FUN_WU.m about the following:
    (1) Get individual graph metrics/graph measures.
    (2) Get individual correlation matrices/adjacency matrices.

    Please follow the steps below:

    Step 1: Copy and paste the following codes at the end of example_FUN_WU.m

    %% Get individual correlation matrices
    adjacency_matrices1 = cellfun(@(x) x.get('A'), a_WU1.memorize('G_DICT').getItems, 'UniformOutput', false); % all individuals from group 1
    adjacency_matrices2 = cellfun(@(x) x.get('A'), a_WU2.memorize('G_DICT').getItems, 'UniformOutput', false); % all individuals from group 2
    
    %% Get individual graph measure
    ms1 = cellfun(@(x) x.getMeasure('Strength').memorize('M'), a_WU1.memorize('G_DICT').getItems, 'UniformOutput', false); % all individuals from group 1
    ms2 = cellfun(@(x) x.getMeasure('Strength').memorize('M'), a_WU2.memorize('G_DICT').getItems, 'UniformOutput', false); % all individuals from group 2

    Step 2: Run the revised example_FUN_WU.m by clicking on the run button

    Step 3: Check the variable adjacency_matrices1 for all individual correlation matrices (weighted-undirected in this example) from group 1, and adjacency_matrices2 for group 2

    Step 4: Check the variable ms1 for all individual calculated metrics (strength in this example) from group 1, and ms2 for group 2

    Thank you, and let me know if you have any questions.
    Best regards,
    Yu-Wei

    • This reply was modified 1 week, 2 days ago by Yu-Wei Chang.
    • This reply was modified 1 week, 2 days ago by Yu-Wei Chang.
    • This reply was modified 1 week, 2 days ago by Yu-Wei Chang.
    • This reply was modified 1 week, 2 days ago by Yu-Wei Chang.
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.