Package: imaging-transcriptomics
Imaging TranscriptomicsImaging transcriptomics is a methodology that allows to identify patterns of correlation between gene expression and some
property of brain structure or function as measured by neuroimaging (e.g., MRI, fMRI, PET).Theimaging-transcriptomicspackage allows performing imaging transcriptomics analysis on a neuroimaging scan
(e.g., PET, MRI, fMRI...).The software is implemented in Python3 (v.3.7), its source code is available on GitHub, it can be installed via Pypi and
is released under the GPL v3 license.NOTEVersions from v1.0.0 are or will be maintained. The original script linked by the BioRxiv preprint (v0.0) isstill available on GitHubbut no changes will be made to that code. If you have downloaded or used that script please
update to the newer version by installing this new version.InstallationNOTEWe recommend to install the package in a dedicated environment of your choice
(e.g.,venvoranaconda). Once you have created your environment and you
have activated it, you can follow the below guide to install the package and dependencies. This process will avoid
clashes between conflicting packages that could happen during/after the installation.To install theimaging-transcriptomicsPython package, first you will need to install two packages that can't be installed directly from PyPi, but require to be downloaded from GitHub.
The first package to install ispypyls. To install this package you can follow the installation on the documentation for the package or simply run the commandpipinstall-egit+https://github.com/netneurolab/pypyls.git/#egg=pylsthe second package is theenigmatoolboxwhich you can install by following the installation procedure from the developers, which is:gitclonehttps://github.com/MICA-MNI/ENIGMA.gitcdENIGMA
pythonsetup.pyinstallAfter this, to download the package, and its dependencies directly from GitHub by usingpip.Once this package is installed you can install theimaging-transcriptomicspackage by runningpipinstallimaging-transcriptomicsWARNINGAt this time the package might some problems running on Mac
computers that have the M1 chip instead of the Intel ones. The problem is
not due to the package but on the chip architecture in running Python.
We're currently working to test some solution for this.UsageOnce installed the software can be used in two ways:as standalone scriptas part of some python scriptWARNINGBefore running the script make sure the Pyhton environment where you have installed the package is activated.Standalone scriptTo run the standalone script from the terminal use the command:imagingtranscriptomicsoptions{corr,pls}Theoptionsavailable are:-i (--input): Path to the imaging file to analise. The path should be given to the program as an absolute path (e.g.,/Users/myusername/Documents/my_scan.nii, since a relative path could raise permission errors and crashes. The script only accepts imaging files in the NIfTI format (.nii,.nii.gz).-o (--output)(optional): Path where to save the results. If none is provided the results will be saved in the same directory as the input scan.-r(optional): Regions of the brain to use for the estimation. Can be either "cort+sub" (or equivalently "all") to use all regions or "cort" to use only cortical regions.--no-gsea(optional): If this option is provided the GSEA analysis will not be performed.--geneset(optional): Name of the geneset to use to run GSEA. The
full list is available in the documentation or by running theimt_gsea  availcommand.
Additionally to the above options two specific commands (required) are available:corr: To run the correlation analysis.pls: To run the PLS analysis. If you choose to run the pls analysis
there are two additional options available:--ncomp: number of components to use in the PLS analysis.--var: variance to estimate from the data.Part of Python scriptWhen used as part of a Python script the library can be imported as:importimaging_transcriptomicsasimtThe core class of the package is theImagingTranscriptomicsclass which  gives access to the methods used in the standalone script.
To use the analysis in your scripts you can initialise the class and then simply call theImagingTranscriptomics().run()method.importnumpyasnpimportimaging_transcriptomicsasimtmy_data=np.ones(41)# MUST be of size 41# (corresponds to the regions in left hemisphere of the DK atlas)analysis=imt.ImagingTranscriptomics(my_data,method="pls",n_components=1,regions="cort+sub")analysis.run(gsea=False)# If instead of running PLS you want to analysze the data with correlation you can run the analysis with:analysis=imt.ImagingTranscriptomics(my_data,method="corr",regions="cort+sub")Once completed the results will be part of theanalysisobject and can be accessed withanalysis.gene_results.The import of theimaging_transcriptomicspackage will import other helpful functions for input and reporting. For a complete explanation of this please refer to theofficial documentationof the package.DocumentationThe documentation of the script is available atimaging-transcriptomics.rtfd.io/.TroubleshootingFor any problems with the software you canopen an issue in GitHuborcontact the maintainer) of the package.CitingIf you publish work usingimaging-transcriptomicsas part of your analysis please cite:Imaging transcriptomics: Convergent cellular, transcriptomic, and
molecular neuroimaging signatures in the healthy adult human brain.Daniel Martins, Alessio Giacomel, Steven CR Williams, Federico Turkheimer,
Ottavia Dipasquale, Mattia Veronese, PET templates working group. Cell
Reports; doi:https://doi.org/10.1016/j.celrep.2021.110173Imaging-transcriptomics: Second release update (v1.0.2).Alessio Giacomel, & Daniel Martins. (2021). Zenodo.https://doi.org/10.5281/zenodo.5726839Integrating neuroimaging and gene expression data using the imaging transcriptomics toolbox.
Alessio Giacomel, Daniel Martins, Matteo Frigo, Federico Turkheimer, Steven CR Williams, Ottavia Dipasquale, and Mattia Veronese. STAR Protocols; doi:https://doi.org/10.1016/j.xpro.2022.101315