dataesr/scientific-paragraphs-categorization huggingface dataset:
The surrogate control module When validating results obtained from large multidimensional datasets, the use of appropriate control surrogate datasets is critical. This module (steps 53-55) allows pooling user-defined features of neurons within the assemblies (e. g. , pooling the average neuronal activation frequencies, the neuronal tuning curves, neuronal phenotypes, pair-wise activity correlations, pair-wise topographical distances, etc. ) to assess the statistical significance of the assemblies with respect to surrogate shuffled datasets. Certainly, the choice of control datasets that serve as null models will depend on the particular scientific question being statistically tested. Here, we focus on two particular kinds of control datasets. We preserve the imaged fluorescence dynamics of all ROIs, and regroup ROIs according to: i) surrogate shuffled assemblies (where the ROIs of any given original assembly are randomized); ii) surrogate assemblies that preserve the original assemblies' spatial features (see Box 1 and Fig.
Random surrogate assemblies (RSAs) For these control datasets, we permute the indexing of the entire neuronal population for each experiment. These permutations allow the creation of a set of shuffled surrogate assemblies for each experiment by using the original dataset clustering (i. e. , the original non-permuted neuronal assemblies), but sampling neurons according to the permuted indexes. This procedure randomizes only the spatial topographies of the assemblies, while keeping every other feature of a given dataset intact (e. g. , the particular overlaps between assemblies, the number of neurons per assembly, the topographical position and the activation time series of each neuron). Conserving these properties enables testing the specificity of the neuronal associations present in the assemblies.
Detection of functional assemblies The identification of assemblies in large neuronal datasets is still an open problem in neuroscience. Template-matching studies have been successful in revealing the activation dynamics of a predefined population pattern  44. These are supervised learning algorithms, since they work on labeled data (i. e. , the given pattern of interest). However, to reveal hidden structure from unlabeled data, unsupervised learning algorithms are necessary. Between these approaches, we can highlight pioneering studies seeking to assess the presence of higher-order (i. e. , higher than pair-wise) correlations in neuronal activity  45, 46. However, these approaches only work for triplets in sets of a few tens of neurons, and did not identify the neurons that participated in the correlations.
This is important, since there is still no clear agreement on which statistical features should be preserved in these control surrogate datasets. Despite these important advances, because PCA represents the data in a space of orthogonal PCs, using PCs to delineate assemblies is misleading when neurons participate in different functional assemblies  18. The PCA-promax algorithm thus further extends this work, relaxing the orthogonality condition and using the promax-rotated PCs to isolate assemblies. In this way, the algorithm is capable of detecting non-exclusive assemblies that share ROIs. Furthermore, this approach is data-driven, without the need for any parameter fine-tuning. In contrast, two of the most popular unsupervised clustering algorithms used in the field, k-means clustering and hierarchical clustering (both also implemented in this toolbox), rely on the definition of key parameters (i.
This improvement is most probably due to the fact that while both k-means and hierarchical clustering group variables according only to pair-wise distance measures (e. g. , pair-wise correlation coefficients, euclidean distances, etc), PCA is designed to reveal the global underlying correlational structure of the dataset through an eigenvector-based multivariate analysis. Furthermore, this improvement could also be related to the previously mentioned fact that k-means and hierarchical clustering seek to detect independent or hierarchically organized clusters, respectively (see The module for detection of assemblies). While the former clustering feature is clearly not in agreement with the distributed nature of brain processing, the latter hierarchical character may be consistent with the hierarchical organization across brain regions, but is probably not compatible with the functional organization at the neuronal sub-circuit level.
Importantly, since the PCA-promax method involves a dimensionality reduction procedure, it is effective in processing large datasets, as demonstrated by the detection of biologically relevant assemblies in whole-brain zebrafish light-sheet imaging experiments (~ 40,000 ROIs, Fig. 5 ). To our knowledge, few studies  7, 8, 59  have attempted to perform clustering in these large-scale imaging datasets, and they have all used k-means clustering. As discussed above, functional clustering of neuronal data is a complex mathematical procedure still under development, and the PCA-promax method for detecting assemblies has limitations. The algorithm relies on PCA, which implements linear data transformations. Thus, non-linear neuronal activity correlations (i. e. , when plotting the activity of a neuron against another neuron produces a curved cloud of points) could result in spurious assemblies.
For example, Tomek et al. presented a supporting module to export fluorescence data along with stimulation time tags, which the user could in turn use to additionally develop a mapping procedure of functional responses. Here, we present an interactive response analysis module capable of automatically producing publication-quality figures, rich in interpretable functional information (Fig. 4 ). Furthermore, our package performs automatic cluster analysis for the detection of neuronal assemblies, even in whole-brain data (Pnevmatikakis et al. only pre-processed and segmented this kind of large-scale data). Finally, it contains modules for interactive and exploratory analysis of the neuronal population activity in the context of experimental and/or behavioral events, which can be extremely useful when dealing with such complex and multivariate datasets.
PREVIOUS APPLICATIONS This toolbox has been used by previously reported studies for the analysis of calcium imaging data of transgenic GCaMP-expressing zebrafish larvae. We used the toolbox in order to study the spontaneous neuronal activity patterns of large (~1000) neuronal populations in the optic tectum (OT), by monitoring GCaMP3 fluorescence through two-photon microscopy (4 Hz scanning rate). Through the PCA-promax clustering algorithm, we demonstrated that the ongoing spontaneous activity of this sensory brain region was organized in assemblies of functionally similar neurons, which reflected neuronal mechanisms that assure robust circuit functioning for the extraction of behaviorally relevant visual information  9. Thompson and colleagues also used this algorithm for detecting assemblies from GCaMP5G single-plane light-sheet imaging data of ~500 simultaneously monitored OT ROIs scanned at 10 Hz, revealing tectal assemblies responsive to different sensory modalities  20.
2a ) or expressing genetically encoded GCaMP6s (sampled at 7 Hz; Fig. 2b ) imaged through twophoton microscopy, and in transgenic zebrafish larvae imaged through large-field two-photon mi -croscopy (GCaMP3, sampled at 1 Hz; Fig. 2c ) or single-photon light-sheet imaging (GCaMP5, sampled at 100 Hz; Fig. 2d ). Moreover, we show that the module for detecting assemblies is remarkably efficient in finding biologically meaningful assemblies in datasets of multi-plane whole-brain light-sheet imaging in zebrafish larvae, consisting of more than 40,000 ROIs scanned at 2. 1 Hz (Fig. 5 ).
Segmentation of morphological Regions of interest (ROIs) and extraction of their fluorescence traces 10) Run the script FindROIs. m and select the fluorescence imaging TIFF file. Set the image pixel size in the x and y directions (in μm). To use the algorithm for automatic morphological ROI segmentation, select Automatically detect single-neuron ROIs and continue along steps 12-19. To implement a grid of adjacent hexagonal ROIs, select Use hexagonal grid of ROIs (proceed to steps 11-12, skipping steps 13-19). Otherwise, to import a pre-defined mask of ROIs or define ROIs through manual drawing, select Import or manually draw all ROIs, and then respectively select Manually draw all ROIs (and continue with steps 13 and 19), or Import ROIs and select a. mat file containing the desired ROI masks (see Box 2 for file format; then proceed to step 20, skipping steps 11-19).
In all cases, at the end of the selected procedure, all the resulting relevant variables will be saved in a Matlab file with a _ALL_CELLS. mat suffix to the TIFF filename. 11) Select the diameter (in μm) of each hexagonal ROI. 12) Draw the perimeter of a closed polygon mask that encloses the imaged optical plane region to be segmented in ROIs. Right-click inside the mask and select Create mask to define it. For the Use hexagonal grid of ROIs option, the obtained hexagonal ROIs inside the mask will be displayed and results will be saved. 13) Move the Gamma and Contrast sliders in the GUI to optimize the display of the image and better visualize the segmentation (i. e. , it will not affect the performance of the segmentation algorithm for the Automatically detect single-neuron ROIs option). When satisfied with the image, click on Continue.
20) Run the script ProcessFluorescenceTraces. m. The goal of this script is to determine the significant fluorescence transients in the data. Select the file with the _ALL_CELLS. mat suffix which contains the ROIs' fluorescence traces. 21) Set the imaging parameters: the sampling frequency of the imaging video, and the fluorescence decay time constant of the reporter (τ; default value is the one reported for GCaMP3  66  , but for the correct detection of significant fluorescence transients, the τ of the imaged calcium reporter should be used). 22) Set the parameters for a data sanity test to eliminate ROIs whose fluorescence dynamics displays artifacts or have low signal-to-noise ratios (SNRs). The parameters are: the minimal number of pixels per ROI; the minimal ROI fluorescence relative to the baseline, used to detect ROIs whose fluorescence is too dim (lower parameter values will require more fluorescence from adequate ROIs); and the maximal sudden decrease in ROI baseline fluorescence, which detects ROIs whose baseline fluorescence is not stable (higher parameter values will require more stable fluorescence from adequate ROIs).
27) Choose the minimal baseline-noise-scaled ΔF/F0 for an ROI's significant fluorescence transient (ΔF/F0 x 1/σ; a measure of the SNR of the ROI's transient). The default value for this parameter is 3 (i. e. , only variations bigger than 3 times the baseline fluorescence noise level are considered significant). This parameter can be adjusted according to the SNR of the imaging video. The result of this section's analysis is saved in a Matlab file with a _RASTER. mat suffix. 28) Set the minimal confidence (based on the noise model) that an ROI fluorescence transient is not noise (default is 95%). These values can be adjusted according to the SNR of the imaging video. The result of this section's analysis is saved in a Matlab file with a _RASTER. mat suffix. 29) Select a. mat file containing a T x N array called significantTransients, where T and N are the number of imaging frames and ROIs, respectively.
This array should contain a 1 at position (i,j) if the ROI i at imaging frame j showed a significant fluorescence transient, or 0 otherwise. The result of this section's analysis is saved in a Matlab file with a _RASTER. mat suffix. 30) Select if you want to display examples of ROI ΔF/F0 traces along with the significant transients obtained highlighted in red (Figs. 2  and 6d ). If you select Yes, you will then set the number of example traces to plot (ordered by level of ROI activity), and the ΔF/F0 scale of the plot. Once plotted, you will be asked if more traces should be displayed.
CRITICAL The Static threshold option is a simpler framework, but may be prone to detecting false positives in noisy data. The Dynamic threshold option is more computationally demanding, imposing larger constraints on the data (inferring data-driven noise models, hence making stronger assumptions on the data). However, it is more robust in the detection of real fluorescence transients in noisy data, especially for long videos (longer than ~3000 imaging frames). Therefore, the choice depends on the SNR of the dataset, and the user's outlook as to the analytical framework. We recommend testing both options and evaluating the result displayed at step 30.
Analysis of neuronal responses 31) Run RunResponseMapping. m and select the file with the _RASTER. mat suffix, produced either through this toolbox, or with data imported from other methods (for the format of this file, see Imported Fluorescence Data File in Box 2). 32) Select the. mat file with the timing information of the experimental events to be associated with ROI responses (for the format of this file, see Response Analysis Input File in Box 2). 33) Set the parameters for the procedure: the duration of each experimental event, and the duration of the time window, locked to event onset, over which ROI responses will be calculated. A graph will display the spatial topography of ROI responses (Fig. 4a ). 34) To improve visualization of the data, click on Remap colors to adjust the saturation and value channels (if only one kind of experimental event was provided in step 32, color saturation will not be used).
This will modify how response features are color scaled. Set the offset, lower and upper bound of the channels. Both the original and rescaled channels will be displayed (Fig. 4b ), along with the spatial topography of ROI responses using the new color code (Fig. 4c ). 35) Add or remove a transparency to the drawn ROIs proportional to their corresponding value channel by clicking on Transp. on/off (default is transparency on). 36) To display the average and single-trial responses and the tuning curve of a particular ROI (Figs. 4d, e ), click on Select ROI and right-click on the ROI of interest. Change the layout of the average and single-trial responses by clicking on Plot order and choosing the number of rows used to display them. 37) When finished, click on Save and the calculated responses will be saved in a file with a _RESPONSE_MAP.
mat suffix. 38) If you wish to find assemblies for a multi-plane volumetric imaging experiment, run CombineMulti-Plane. m and select all the _RASTER. mat suffix files that correspond to each imaged plane (for data imported from other methods see Imported Fluorescence Data File in Box 2). This will generate files with _MultiPlane_ALL_CELLS. mat and _MultiPlane_RASTER. mat suffixes that you should use in the next step. Otherwise, for single-plane imaging experiments, skip this step. 39) Run the program FindAssemblies. m, and select the file with the _RASTER. mat suffix (for data imported from other methods see Imported Fluorescence Data File in Box 2). 40) Select the clustering algorithm to be used. For PCA-promax, skip steps 44-45; for k-means, skip steps 41-43 and step 45; and for hierarchical clustering, skip steps 41-43.
Imported Fluorescence Data File For T imaging frames and N ROIs, a. mat file with the _RASTER. mat suffix contains the following variables: deltaFoF: a T x N matrix of the ∆F/F0 time series of all ROIs. raster: a T x N matrix. For each column (i. e. , each ROI), it is filled either with zeros for frames with non-significant fluorescent transients or with the ∆F/F0 values of the frames with significant transients. If the user does not wish to plot significant trial responses in the response analysis module, or if all the ∆F/F0 values should be considered in the module for the detection of the assemblies (instead of only the significant transients), it should be a T x N matrix filled with ones. movements: T x 1 binary array, with ones for frames where an imaging artifact was found, and otherwise zeros.
Response Analysis Input File A. mat file containing a 1 x S Matlab cell array called mapData, where S is the total number of experimental event types (for the OT case study, these are the azimuth positions of the visual stimuli). Each layer of the cell array (e. g. , each stimulation position), should contain the following variables: label: a string with the corresponding event label for the Mapping parameter color bar (e. g. , "-35 o "). value: a scalar with the corresponding parametric value of the mapped event (e. g. , "35"). onsetTime: a vector of scalars corresponding to the timing information in seconds of each event trial (e. g. , "[10. 0 25. 2 37. 1]" for 3 trials).
File With ROI Features to Test Against Surrogate Assemblies For evaluating certain features of the assemblies, the user must provide a. mat file with the features to be tested against the control surrogate datasets. To test F features, this file should contain a Matlab cell array called variable, whose dimension should be Fx1 (that is, one cell for each feature). For a total population of N neurons, the dimension of each cell in variable depends on the kind of feature to be tested, as described below. Single-neuron features: for a scalar feature Fi (e. g. , the average activation rate of each neuron), variable{Fi} should have a dimension of Nx1. For a vectorial feature Fi sampled at m conditions (e. g. , the response tuning curves of neurons with respect to a visual stimulus at m positions of the visual field), variable{Fi} should be a Matlab structure.
Results will be saved in a Matlab file with a _CLUSTERS. mat suffix. 47) Run AssembliesActivations. m. This script will analyze all the population activity bouts and estimate if they can be confidently assigned to specific neuronal assemblies. Select the file with the _CLUSTERS. mat suffix obtained in the previous step. Select the threshold p-value to calculate the significance of the acti-TROUBLESHOOTING To evaluate the validity of the obtained assemblies, run steps 38-47 choosing different methods and parameters, and then run the program indexesAssemblies. m on all the _CLUSTERS. mat files obtained. This program will test the clusterings in these files, by calculating and displaying the Davies-Bouldin  69  (DB) and the normalized Hubert's Γ 70 cluster quality indexes. You should choose the _CLUSTERS.
Generation of control surrogate datasets for statistical analysis of assemblies' features 54) The program AssembliesVsSurrogate. m will compare user-defined features of original and surrogate assemblies. For this, the program will pool single-neuron features (e. g. , the average frequency and/or intensity of activation, the neuronal tuning curve, the neuronal identity, etc) and/or neuronal-pair features (e. g. , the pair-wise activity correlation, the pair-wise topographical distance, etc. ) according to the neuronal groups represented in the original and surrogate assemblies. You can test F features by providing an appropriate. mat file (see File with ROI Features to Test Against Surrogate Assemblies in Box 2 for the required file format). Run AssembliesVsSurrogate. m, select the _CLUSTERS.
mat file, then the. mat file for the neuronal features, and the program will compare against the surrogate assemblies stored in the _SURROGATE_CLUSTERS. mat file created in the previous step. 55) A set of graphs will be displayed for each kind of surrogate assembly used (Random, or Topographical; Fig. 9a ). For scalar variables, each graph will display a histogram of the pooled features of the original (top panel) and the surrogate assemblies (bottom panel; Fig. 9b, c ). For vectorial variables, histograms are replaced by a graph of the average feature curve (black line) and pooled single-neuron curves (gray lines). The final pooled features will be saved in a file with a _ASSEMBLIES_vs_SURROGATE. mat suffix that contains the original and surrogate assemblies' features in Fx1 cell arrays named varAssemblies and var-NMs, respectively.
RESULTS The file called OT_reg_smooth. tif (in the folder Test data of the toolbox distribution) contains data from a two-photon imaging experiment of the optic tectum (OT) of transgenic GCaMP3-expressing zebrafish larvae. It will be used as a case study in this section. In this experiment, the OT was imaged while periodically stimulating the larva with single light spots in different positions of the larva's visual field to map the OT functional retinotopicity. With this case study, we wish to illustrate the use of the toolbox and, furthermore, assist users who wish to adapt this procedure to their own datasets. We also comment on the results obtained when analyzing other kinds of data. We will focus on the more involved procedures of the protocol, skipping some of the simpler initial preprocessing steps.
Hence, this case study has been already registered for drifts of the optical plane using SmoothRegistration. m as explained in step 1 (for a demonstration of the registration effect, compare with the unregistered OT. tif file), and movement artifacts have already been detected as explained in steps 2-9 (artifacts were detected with default parameter values, and were stored in OT_reg_smooth_ARTIFACTS. mat). The user is encouraged to perform all the protocol steps on this case study, but we also provide all the remaining Matlab files that we obtained with the tutorial (see folder Test data\Processed files), so that users can compare their own results. For the OT case study, Figures  6a-c  show the parameters selected for the intermediate steps and a typical result of using the semi-automatic ROI detection algorithm, as described in steps 12-19.
For the present examples, after setting the parameters for ROI segmentation (steps 12-18) and filtering (step 19), we had to curate 9% of the ROIs for the OT (Fig. 6 ) and both mouse cortical datasets (Fig. 2a, b ), while for the large-field zebrafish dataset, 8% of the ROIs were curated (Fig. 2c ). For the single-plane single-photon light-sheet imaging dataset shown in Figure  2d , we had to curate 15% of the ROIs, due to the lower spatial resolution of this technique. Since simultaneous multi-plane light-sheet imaging does not guarantee single-neuron resolu- Frequency latent organizing principles of the data in an unsupervised manner. The assemblies' activation dynamics can also be further studied using steps 51-52. In Figure  8 , we present an example of the dynamics of a few selected assemblies, confirming that most of them are engaged by some light-spot stimulations, as indicated by the experimental time tags provided in the OT_reg_smooth_TimeTags.
Figure5. Detection of assemblies of correlated ROIs in zebrafish whole-brain light-sheet imaging reveals the spatial structure of brain activity. Example of a transgenic zebrafish larva pan-neuronally expressing GCaMP5 (HuC:GcaMP5). The larva was volumetrically scanned with fast multi-plane single-photon lightsheet microscopy. 40 optical sections, separated by 5 μm steps in the axial direction, were imaged almost simultaneously at 2. 1 Hz. Due to the lack of single-neuron resolution in this imaging dataset, a grid of hexagons (9 μm in diameter representing approximately the area of an average neuron) was imposed over each imaged optical plane to obtain a total of >40,000 ROIs laid out over the entire nervous system. (a-f) Some of the ROI assemblies found with the PCA-promax approach, displayed over the maximal intensity projection of all imaged optical sections (for individual optical sections see Supplementary Video 1).