Skip to main content

pNet: a python package for computing personalized fucntional networks

Project description

pNet

pNet is a Python package for computing personalized, sparse, non-negative large-scale functional networks from functional magnetic resonance imaging (fMRI) data, particularly resting state fMRI data. The personalized functional networks are comparable across subjects while maintaining subject specific variation, reflected by their improved functional coherence compared with their group-level counterparts. The computation of personalized functional networks is accompanied by quality control with visualization and quantification of their spatial correspondence and functional coherence in reference to their group-level counterparts.

image

Getting started

Follow the Installation Instructions to install pNet, and then check out the Tutorials and Examples to learn how to get up and running!

Download and install pNet

1. Download pNet

git clone https://github.com/MLDataAnalytics/pNet

2. Create a new conda environment for pNet

cd pNet
conda env create --name fmripnet -f environment_pnet.yml

3. Install pNet

conda activate pnet
pip install .
# or pip install fmripnet

Script usages

1. Prepare data

1) a number of preprocessed fMRI scans that have been spatially aligned to a template space,
2) a mask image for excluding voxels/vertices of uninterest,
3) a brain template image/surface for visualization
4) a script can be found in cli folder for preparing the brain template data

2. Run the computation (examples can be found in examples folder)

5) a script (fmripnet.py) can be found in cli folder  for running the computation, supplied with a configuration file (*.toml) for setting the input and output information
   run "python fmripnet.py -h " to get help information
   run "python fmripnet.py -c a_config.toml" to start the computation
   run "python fmripnet.py -c a_config.toml --hpc qsub" to start the computation on a HPC cluster with qsub

Code examples and usages

1. Prepare data

1) a number of preprocessed fMRI scans that have been spatially aligned to a template space,
2) a mask image for excluding voxels/vertices of uninterest,
3) a brain template image/surface for visualization

2. Setup the computation

1) the number of functional networks,
2) the output folder information,
3) optional parameters

3. Example code:

import pnet

# create a txt file of fMRI scans, each line with a fMRI scan 
file_scan = 'sbj_lst.txt'
# create a brain template file consisting of information of the mask image and the brain template for visualization or use a template that is distributed with the package) 
file_Brain_Template = pnet.Brain_Template.file_MNI_vol

# Setup
# data type is volume
dataType = 'Volume'
# data format is NIFTI, which stores a 4D matrix
dataFormat = 'Volume (*.nii, *.nii.gz, *.mat)'
# output folder
dir_pnet_result = 'Test_FN17_Results'

# number of FNs
K = 17

# Setup number of scans loaded for each bootstrap run for estimating group functional networks
sampleSize = 100 # The number should be no larger than the number of available fMRI scans. A larger number of samples can improve the computational robustness but also increase the computational cost.  Recommended: >=100
# Setup number of runs for bootstraps
nBS = 50         # A larger number of run can improve the computational robustness but also increase the computational cost. recommended: >=10
# Setup number of time points for computing group FNs with bootstraps
nTPoints = 200   # The number should be no larger than the number of available time points of the fMRI scans. A larger number of samples can improve the computational robustness but also increase the computational cost.  If not set, all available time points will be used if smaller than 9999.

# Run pnet workflow
pnet.workflow_simple(
        dir_pnet_result=dir_pnet_result,
        dataType=dataType,
        dataFormat=dataFormat,
        file_scan=file_scan,
        file_Brain_Template=file_Brain_Template,
        K=K,
        sampleSize=sampleSize,
        nBS=nBS,
        nTPoints=nTPoints
    )

Support

If you encounter problems or bugs with pNet, or have questions or improvement suggestions, please feel free to get in touch via the Github issues.

Previous versions:

Matlab and Python: https://github.com/MLDataAnalytics/pNet_Matlab

Matlab: https://github.com/MLDataAnalytics/Collaborative_Brain_Decomposition

GIG-ICA: https://www.nitrc.org/projects/gig-ica/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fmripnet-1.0.1a0.tar.gz (46.6 MB view details)

Uploaded Source

Built Distribution

fmripnet-1.0.1a0-py3-none-any.whl (46.7 MB view details)

Uploaded Python 3

File details

Details for the file fmripnet-1.0.1a0.tar.gz.

File metadata

  • Download URL: fmripnet-1.0.1a0.tar.gz
  • Upload date:
  • Size: 46.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.13

File hashes

Hashes for fmripnet-1.0.1a0.tar.gz
Algorithm Hash digest
SHA256 29997949db177e53869397d622c4105a24c7ac950efeac1061afbde48db882b8
MD5 b1559913ccc6f401d0c67dffc90074bf
BLAKE2b-256 9a49256f38c1a4314a5c521abc15113bc4ca7fc89c9ed434a334a0d1bdd7dd55

See more details on using hashes here.

File details

Details for the file fmripnet-1.0.1a0-py3-none-any.whl.

File metadata

  • Download URL: fmripnet-1.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 46.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.13

File hashes

Hashes for fmripnet-1.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fd17ef30ede5e008ed13ccb7e2183b626425e2107d454bdf333f60a97d986dd
MD5 bc2686727d7e0f5cbd1ec3a94454c88b
BLAKE2b-256 e95bbc502567fac09a466c37490b863acd3213d029f3f110a6f2735a5dc21fc5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page