Skip to content

Instantly share code, notes, and snippets.

@abhi-glitchhg
Last active September 27, 2023 15:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhi-glitchhg/5fc28c1bae62104f7cf507b453cd72a0 to your computer and use it in GitHub Desktop.
Save abhi-glitchhg/5fc28c1bae62104f7cf507b453cd72a0 to your computer and use it in GitHub Desktop.
Google Summer of Code @ INCF

Project Description:

The Virtual Brain (TVB) is a scientific simulation platform that provides all means to generate, manipulate and visualize connectivity and network dynamics of the brain networks. Researchers in Computational Neuroscience use brain network models to understand the dynamic behavior of the healthy and diseased brain, as measured by various neuroimaging techniques such as fMRI, EEG, and MEG. TVB is currently the only neuroinformatics project providing a platform for researchers to work together on modeling studies using brain network models with realistic connectivity.

The modeling of the simulations requires datasets generally hosted on data storage platforms like Zenodo, OpenSourceBrain, EBRAINS, etc. One has to download the dataset manually, unzip it and then use it inside the web GUI.

Instead of manually downloading and unzipping the data, the project's goal is to have a dedicated framework to manage the downloading and unzipping the dataset from remote sources. Right now, we are focusing on the Zenodo platform

My work on this feature can be found in this branch: https://github.com/the-virtual-brain/tvb-root/tree/TVB-1999-deo or in this pr against the master : https://github.com/the-virtual-brain/pulls/691

Usage:

In the proposed idea, there is a Zenodo class through which one will interact with the Zenodo API.

The response from the Zenodo API is stored in the Record class.

One can use the above Zenodo and Record classes like,

#instantiate the Zenodo class
zen = Zenodo() 

# Suppose you are interested in working with a specific repository.
# for this example lets consider https://zenodo.org/record/4263723 as the repository you are interested in.

#then we can get the `record` object back using the get_record method of the zenodo class. In our case, "4263723" is the record id.

record = zen.get_record("4263723")

print(record)
# this will print the formatted json response from the zenodo api

print(record.describe())
# this will print the project description 

# to donwload the files associated with this record at the current working directory, 
record.download(path = "./")

There is a special class created to work with the tvb_data called TVBZenodoDataset.

# you can specify which version of the data you are interested in, and where you want to download and extract the data.
dataset = TVBZenodoDataset(version= "2.0.3", extract_dir=<enter your path here>)


# once you have instantiated the TVBZenodoDataset class, you can fetch files using `fetch_data` method.
# this method returns the absolute path of the file. 

connectivity_66_file_path = dataset.fetch_data("connectivity_66.zip")

# you can check if the file exists in the file system or not by
import pathlib

assert pathlib.Path(connectivity_66_file_path).is_file()

TO DO

Implement data caching in CI/CD pipeline to improve the testing speed.

Extend the datasets for EBRAINS and other similar platform.

Acknowledgement

I'd like to thank Google Summer of Code (GSOC) for providing an amazing platform, and my organization INCF for giving me the chance to work on this project.

I also want to express my gratitude to my mentors, Lia Domide and Romina Baila, for their incredible support and guidance throughout this project.

It's been an awesome learning experience!

@liadomide
Copy link

Hi Abhijit.
This doc looks decent.
It might seem minor, but I think it would be good to have somehow mentioned INCF as organisation, and Google Summer of Code (plain, not just the abbreviation in the page name). Perhaps 2 sentences in the Acknowledgement ?

@abhi-glitchhg
Copy link
Author

Hi Abhijit. This doc looks decent. It might seem minor, but I think it would be good to have somehow mentioned INCF as organisation, and Google Summer of Code (plain, not just the abbreviation in the page name). Perhaps 2 sentences in the Acknowledgement ?

i agree. I have updated the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment