Skip to content

plot_tract_profiles and data harmonization with pyAFQ data #32

Description

@MeaghanPerdue

Hello!

Following my previous post with a separate issue.
I'm trying to use AFQ-Insight for combat harmonization and regression analysis of my multi-site pyAFQ tract profiles dataset.
I'm running AFQ-Insight v0.7.1 in a conda env with python 3.12

I'm able to load in my multi-site data for harmonization, but ran into an issue with plot_tract_profiles where it appears to expect classic (matlab?) AFQ bundle identifiers. For example:

site_figs = plot_tract_profiles(
...     X=afqdata,
...     group_by=afqdata.y[:, 0],
...     group_by_name="Site",
...     figsize=(14, 14),
... )
  0%|                                                   | 0/28 [00:00<?, ?it/s]
  0%|                                                    | 0/2 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/envs/afq/lib/python3.12/site-packages/afqinsight/plot.py", line 264, in plot_tract_profiles
    ax = axes[plt_positions[bundle_id][0], plt_positions[bundle_id][1]]
              ~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: np.str_('Callosum Anterior Frontal')

With some AI assistance, I've created a work-around to get it to map my pyAFQ bundles to the internal bundle names, plot the profiles, harmonize, and re-plot the harmonized data. This seems to work ok, but I'm not sure if it's actually problematic because the resulting "harmonized" plots look bad for the corpus callosum segments. I'm trying to figure out if this is due to the data itself, or my work-around. Here's my full script:

harmonize_elgansites.py

And here are the before and after harmonization profiles:
Before harmonization:
Image

After harmonization:

Image

the different sites include scanners from Philips, Siemens, and GE, and I've already observed differences by vendor such that sites appear to cluster within broader vendor groups, so I think that could be driving some of the clustering in the post-harmonization data, is that something I should account for in the harmonization itself? I have only 199 subjects across 11 sites so the Ns within each vendor are quite small which is

I'd appreciate any thoughts on this!
Thanks!
Meaghan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions