Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
6f2208a
feat: merged step1 and step2 into one file
sambregeYale Aug 6, 2024
dcc9c55
feat: added func to concatenate bolds
sambregeYale Aug 6, 2024
d48ad35
feat: new wrapper function
sambregeYale Aug 6, 2024
614cb16
feat: initial argparse setup for wrapper
samuelbrege Aug 6, 2024
f1f5301
feat: added flags for main PyCap function
samuelbrege Aug 7, 2024
c82104f
feat: new helper functions
samuelbrege Aug 7, 2024
3c53bf4
feat: motion concatenation moved to pre_pycap
samuelbrege Aug 7, 2024
19ca9dd
feat: added 'examples' dir to contain example code
samuelbrege Aug 16, 2024
ac9082c
chore: removed old ROI definitions
samuelbrege Aug 16, 2024
04ead6b
fix: subj index stored in h5py, concatenate_data uses ndummy
samuelbrege Aug 16, 2024
9573d8f
feat: PyCap wrapper now loads params from config
samuelbrege Aug 16, 2024
4163bb9
feat: new params
samuelbrege Aug 16, 2024
397c6e3
refactor: changed parameter names
samuelbrege Aug 16, 2024
52cab9f
feat: added non-scheduler support for standard steps
samuelbrege Aug 16, 2024
3e68598
feat: added 'cpu_mem' flag
samuelbrege Aug 18, 2024
663d46f
feat: added SLURM support for standard step
samuelbrege Aug 18, 2024
df9e6a5
chore: updated logging
samuelbrege Aug 21, 2024
18a60dc
feat: non-scheduler command support
samuelbrege Aug 21, 2024
19da339
chore: moved old code for reference
samuelbrege Aug 21, 2024
ff97047
feat: Updated scripts with code from Zenodo
samuelbrege Aug 21, 2024
fdf757a
feat: Added Zenodo code
samuelbrege Aug 21, 2024
86f1688
fix: scheduler log
samuelbrege Aug 30, 2024
c149ed5
feat: added seperate 'prep' script
samuelbrege Aug 30, 2024
778476c
docs: added example params for pycap_prep
samuelbrege Aug 30, 2024
f1f802c
feat: now acquires tdim and sdim from data
samuelbrege Sep 2, 2024
d1552aa
feat: renamed params
samuelbrege Sep 2, 2024
a280ed1
fix: yaml parses string as bool
samuelbrege Sep 3, 2024
6a4f6df
feat: add prep as runnable command
samuelbrege Sep 3, 2024
d5ed5bc
feat: new script to hold custom exceptions
samuelbrege Sep 5, 2024
0395205
feat: new utils script to hold internal functions
samuelbrege Sep 5, 2024
c572b24
feat: updated with new param names
samuelbrege Sep 5, 2024
ada806e
feat: now works with wrapper script
samuelbrege Sep 5, 2024
1badd30
feat: updated to work with new prep script
samuelbrege Sep 5, 2024
3583bfd
feat: now saves array dimensions to file
samuelbrege Sep 5, 2024
dcaf5ea
added main pycap script 'pycap_run.py'
samuelbrege Sep 20, 2024
bcec764
chore: updated param names
samuelbrege Sep 20, 2024
31a1321
feat: added params for main run function
samuelbrege Sep 20, 2024
2b24cf7
refactor: removed arg_dict parsing
samuelbrege Sep 20, 2024
f1c4803
feat: convert bool for yaml parsing
samuelbrege Sep 20, 2024
a722edb
feat: added overwrite
samuelbrege Sep 27, 2024
de7d7b4
fix: incorrect data type
samuelbrege Sep 27, 2024
90d720c
fix: step completion notification
samuelbrege Sep 27, 2024
aafc47f
feat: pycap run now functional
samuelbrege Sep 27, 2024
2f12f7e
feat: added split and within job parallelization
samuelbrege Sep 27, 2024
6a1c0e3
chore: fixed warning
samuelbrege Oct 8, 2024
c41e505
chore: updated parser params
samuelbrege Oct 8, 2024
e2c7aa7
feat: job dependencies
samuelbrege Oct 8, 2024
725861c
feat: added 'seedbased' code from bitbucket
samuelbrege Oct 8, 2024
65dc35f
chore: removed 'hpc' from all methods
samuelbrege Oct 8, 2024
e3a7588
chore: removed 'hcp' from filenames
samuelbrege Oct 8, 2024
1472316
chore: removed 'hcp' from filenames
samuelbrege Oct 8, 2024
ad0fa50
fix: import path
samuelbrege Oct 8, 2024
3060860
chore: added missing params
samuelbrege Oct 8, 2024
a5e6dac
feat: concatenation support for Nifti data
samuelbrege Oct 14, 2024
9ede298
fix: Nifti doesn't need gunzip
samuelbrege Oct 15, 2024
98fad69
feat: Added mask support
samuelbrege Oct 15, 2024
e71239a
feat: Added mask support
samuelbrege Oct 15, 2024
22e5fb6
feat: mask compatibility for CIFTI data
samuelbrege Oct 15, 2024
7eb7474
feat: helper function for bold type
samuelbrege Oct 15, 2024
d1e665f
feat: motion compatible with .csv or .tsv like files
samuelbrege Oct 15, 2024
9f2f55d
refactor: swapped bold check to utils func
samuelbrege Oct 22, 2024
051528b
fix: printing wrong filename
samuelbrege Oct 22, 2024
f1d55de
feat: new clustering function allowing all sklearn.cluster funcs
samuelbrege Oct 22, 2024
5910637
refactor: bold_type now uses stand utils func
samuelbrege Oct 22, 2024
b702677
feat: dict conversion functions for CLI parsing
samuelbrege Oct 22, 2024
8b4dd03
feat: now allows multiple clustering methods
samuelbrege Oct 22, 2024
e26e810
feat: now allows multiple clustering methods
samuelbrege Oct 22, 2024
61da5ca
fix: parsing list data
samuelbrege Oct 24, 2024
f0e381a
feat: now support running multiple splits at once
samuelbrege Oct 24, 2024
bc58d43
feat: multiple fixes, now uses job arrays instead of ntasks
samuelbrege Oct 24, 2024
346fec4
fix: param name
samuelbrege Oct 24, 2024
95e622c
fix: returning wrong data format
samuelbrege Oct 24, 2024
ae00eb9
fix: wrong data format
samuelbrege Oct 24, 2024
99ae071
feat: final cluster now compatibile with sklearn.cluster funcs
samuelbrege Oct 24, 2024
01c82a8
feat: PyCap post (finalcluster) now separate function
samuelbrege Oct 24, 2024
4cf0158
docs: updated commands and params
samuelbrege Oct 24, 2024
edcf642
feat: index to id conversion
samuelbrege Oct 26, 2024
8b59509
fix: index to session id conversion:
samuelbrege Oct 26, 2024
43322b9
chore: removed unneccesary args
samuelbrege Nov 20, 2024
79e97bd
chore: renamed training/testing to split1/split2
samuelbrege Nov 20, 2024
143c75f
feat: scrubbing now prep specific
samuelbrege Dec 2, 2024
dd1e0f0
feat: folder structure standardized
samuelbrege Dec 2, 2024
e283348
feat: data orchestration now prep specific
samuelbrege Dec 2, 2024
7d503f8
feat: removed unneccesary parameters
samuelbrege Dec 2, 2024
db4baf4
refactor: pycap changed to clustering, wrapper changed to pycap
samuelbrege Dec 2, 2024
a4219e2
feat: get_seedtype function for checking seedtype
samuelbrege Dec 2, 2024
c03aa40
chore: parameter update
samuelbrege Dec 7, 2024
ab0af4b
feat: bold labelling
samuelbrege Dec 7, 2024
0f56e55
feat: seed_based analysis
samuelbrege Dec 7, 2024
8e9b84c
feat: session list format changed to .csv
samuelbrege Dec 7, 2024
365b5d2
chore: removing old code
samuelbrege Dec 7, 2024
703c999
feat: unrecognized parameters no longer cause error
samuelbrege Dec 10, 2024
5af917d
chore: cleaned code
samuelbrege Dec 10, 2024
988dfa4
chore: removed old files
samuelbrege Dec 10, 2024
d0e7de0
fix: pathing
samuelbrege Dec 10, 2024
4df3741
chore: unneccesary package
samuelbrege Dec 10, 2024
deba9f8
feat: updated Linux conda environment
samuelbrege Dec 10, 2024
a6f5f0e
feat: updated Linux conda environment
samuelbrege Dec 10, 2024
9496845
fix: issues when running without scheduler
samuelbrege Dec 10, 2024
345b054
chore: update example
samuelbrege Dec 10, 2024
9861ade
Update example_config.yml
samuelbrege Dec 11, 2024
f66ae36
Update README.md
samuelbrege Dec 11, 2024
7cfe0a2
Update README.md
Kangjoo Dec 11, 2024
4a1f3a5
feat: basis CAP generation
samuelbrege Jan 15, 2025
487e2af
feat: basis CAP histogram plotting
samuelbrege Jan 15, 2025
4298fb2
feat: Temporal metrics
samuelbrege Jan 15, 2025
95d6e39
Merge branch 'develop' of github.com:Kangjoo/pycap into develop
samuelbrege Jan 23, 2025
db96b47
refactor: renamed pycap to braincap
samuelbrege Jan 28, 2025
ebfb976
refactor: pycap renamed to braincap
samuelbrege Jan 28, 2025
2f1999e
feat: improved group functionality
samuelbrege Apr 3, 2025
3835044
feat: improved group functionality
samuelbrege Apr 3, 2025
1897675
feat: basis CAP generation
samuelbrege Apr 3, 2025
967aeeb
feat: cluster scree plots
samuelbrege Apr 3, 2025
e9ba663
feat: Temporal Metrics function
samuelbrege Apr 3, 2025
658fb62
update temporal metrics
samuelbrege Jun 9, 2025
791eb14
feat: Group comparison script
samuelbrege Jun 9, 2025
3ab522f
feat: Feature selection and dimensional reduction script
samuelbrege Jun 9, 2025
b945357
demo for OHBM2025
samuelbrege Jun 19, 2025
9eb4e2c
Update README.md
samuelbrege Jun 25, 2025
22e7071
update demo
samuelbrege Jun 26, 2025
31557a1
Merge branch 'develop' of github.com:Kangjoo/BrainCAP into develop
samuelbrege Jun 26, 2025
b152a29
Update README.md
Kangjoo Jun 27, 2025
df6b6a2
Update README.md
Kangjoo Aug 4, 2025
014ce3f
changes from Kangjoo
sambregeYale Aug 7, 2025
016a51e
Merge branch 'develop' of github.com:Kangjoo/BrainCAP into develop
sambregeYale Aug 7, 2025
7f8c3c5
fix for tutorials
samuelbrege Aug 7, 2025
07e67db
example yml
samuelbrege Aug 7, 2025
fe543c0
merge
samuelbrege Aug 7, 2025
81ca5d6
outputs saved as h5py files and added metrics option
samuelbrege Aug 7, 2025
5e8d523
added code to load temporal merics
samuelbrege Aug 7, 2025
a39e376
more examples
samuelbrege Aug 7, 2025
f937a49
Update README.md
Kangjoo Aug 22, 2025
edd99ff
fix: compatibility with . in folder names
samuelbrege Oct 10, 2025
a403d71
fix: compatibility with periods in folder names
sambregeYale Oct 10, 2025
7280591
Merge branch 'develop' of github.com:Kangjoo/BrainCAP into develop
samuelbrege Nov 7, 2025
a4de40e
fix: 4D NIFTI compatibility
samuelbrege Nov 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# pycap
# BrainCAP

Codes that were used to generate data and results in Lee et al., bioRxiv, 2023
The analysis of moment-to-moment changes in co-activation patterns (CAPs) in functional MRI (fMRI) has been useful for studying dynamic properties of neural activity. This method is based on clustering fMRI time-frames into several recurrent spatial patterns within and across subjects. Studies have also focused on quantifying properties of the temporal organization of CAPs, such as fractional occupancy and dwell time. The analyses of co-activations are computationally intensive, requiring the clustering of high-dimensional data concatenated over subjects. Further, while a variety of analytic choices are involved in studying CAPs, the field lacks a unified open-source platform to allow a robust feature selection required for reproducible mappings of brain and behavioral measurements. We are currently developing **BrainCAP**, an open-source Python-based toolkit for quantifying CAPs from fMRI data in cross-sectional and longitudinal studies.

This repository serves as the `develop` branch for the ongoing development and enhancement of BrainCAP.

See `brainCAP/examples` for example code.

To clone the Anaconda environment, use
`conda env create -f environment_linux.yml`

![BrainCAP workflow](https://github.com/Kangjoo/BrainCAP/blob/main/images/fig1_workflow.png "fig1_workflow")



---

## Important Notes
1. The official release of BrainCAP has not been announced yet. The developer team is working on the first release of BrainCAP.
2. The current version of this repository is specifically tailored for research environments with access to Yale University’s High Performance Computing (HPC) cluster. Future versions will allow the use of various job schedulers, in addition to Slurm.

---

## Branches

### `main`
The `main` branch contains the latest developments and optimizations for BrainCAP. These codes are optimized for local use on the Yale University High-Performance Computing (HPC) cluster. If you are looking to reproduce the data and results from Lee et al. (2024), please refer to the archived version on Zenodo linked above.

### `develop`
The `develop` branch focuses on building an open-source software toolkit for BrainCAP. We aim to release the first version of this open-source toolkit by the end of **2026**. Contributions, feedback, and collaboration are welcome to help shape the future of BrainCAP.

---

## Citation
If you use BrainCAP in your research, please cite:
> Kangjoo Lee, Jie Lisa Ji, Clara Fonteneau, Lucie Berkovitch, Masih Rahmati, Lining Pan, Grega Repovš, John H. Krystal, John D. Murray, and Alan Anticevic, Human brain state dynamics are highly reproducible and associated with neural and behavioral features, PLOS Biology 22(9): e3002808 (2024)

The specific version of the code used for Lee et al. (2024) is archived and available at **[Zenodo](https://zenodo.org/records/13251563)**.

---

## Maintainers

BrainCAP is currently maintained by:

- **Kangjoo Lee, PhD**
Email: [[email protected]](mailto:[email protected])

- **Samuel Brege, Postgraduate Associate**
Email: [[email protected]](mailto:[email protected])

For inquiries, questions, or collaborations, please contact either maintainer.

---

## Pipeline

We presetned BrainCAP and our demo codes at the software demonstration session of the 2025 meeting of the Organizaiton for Human Brain Mapping (OHBM) in Brisbane, Australia. Find the overview of the BrainCAP pipeline below.

![BrainCAP Pipeline](https://github.com/Kangjoo/BrainCAP/blob/main/images/fig2_pipeline.png "fig2_pipeline")

Note that these codes are optimized for local use at Yale University High Performance Computing cluster.
File renamed without changes.
Loading