Abstract
Visualizing synaptic connectivity has traditionally relied on time-consuming electron microscopy-based imaging approaches. To scale the analysis of synaptic connectivity, fluorescent protein-based techniques have been established, ranging from the labeling of specific pre- or postsynaptic components of chemical or electrical synapses to transsynaptic proximity labeling technology such as GRASP and iBLINC. In this paper, we describe WormPsyQi, a generalizable image analysis pipeline that automatically quantifies synaptically localized fluorescent signals in a high-throughput and robust manner, with reduced human bias. We also present a resource of 30 transgenic strains that label chemical or electrical synapses throughout the nervous system of the nematode C. elegans, using CLA-1, RAB-3, GRASP (chemical synapses), or innexin (electrical synapse) reporters. We show that WormPsyQi captures synaptic structures in spite of substantial heterogeneity in neurite morphology, fluorescence signal, and imaging parameters. We use these toolkits to quantify multiple obvious and subtle features of synapses - such as number, size, intensity, and spatial distribution of synapses - in datasets spanning various regions of the nervous system, developmental stages, and sexes. Although the pipeline is described in the context of synapses, it may be utilized for other ‘punctate’ signals, such as fluorescently-tagged neurotransmitter receptors and cell adhesion molecules, as well as proteins in other subcellular contexts. By overcoming constraints on time, sample size, cell morphology, and phenotypic space, this work represents a powerful resource for further analysis of synapse biology in C. elegans.
Introduction
The nematode C. elegans was the first organism for which a full nervous system connectome was established (White et al., 1986). Connectomes now exist for both sexes (Cook et al. 2019; Hall and Russell, 1991; White et al. 1986), the pharynx (Cook et al. 2020; Albertson and Thomson, 1976), for different developmental stages (Brittin et al., 2021; Witvliet et al. 2021), and for the dauer diapause stage (Yim et al. 2023). However, due to the laboriousness of acquiring and analyzing electron microscopy (EM) images and the resulting small sample sizes, our understanding of many aspects of synaptic connectivity has remained limited. For example, we are only beginning to better understand the extent of developmental and inter-individual variability in synaptic connectivity and adjacency (Cook et al., 2023; Brittin et al., 2021; Witvliet et al. 2021) but we remain much in the dark of how exactly external or internal factors establish, alter, and maintain the synaptic connectome. While progress in CRISPR/Cas9 genome engineering and earlier methods continue to increase the array of mutants available to a C. elegans geneticist, a lack of synaptic fluorescent reporters and difficulty in scoring them remains a bottleneck for large scale mutant analyses. This is especially true in the synapse-dense regions of the C. elegans nervous system, such as the nerve ring.
It has therefore been of paramount interest to establish alternative means to visualize synaptic connectivity that would allow us to score larger sample sizes in living animals. Classically, the study of C. elegans synapse biology has been aided by reporters in which various synaptic components are fluorescently labeled (Figure 1). For chemical synapses, these include reporters labeling pre- and post-synaptic proteins - such as SNB-1/VAMP, RAB-3, SYD-2/Liprin, CLA-1/Piccolo, GLR-1/AMPAR - fused with a fluorescent protein (Xuan et al., 2017; Mahoney et al., 2006; Yeh et al., 2005; Shen and Bargmann, 2003; Zhen and Jin, 1999; Nonet, 1999; Rongo et al., 1998; Jorgensen et al., 1995) and split-fluorophore transsynaptic technology such as GFP Reconstitution Across Synaptic Partners (GRASP) (Feinberg et al., 2008) and other variants (Feng et al., 2020; Feng et al., 2019), and Biotin Labeling of Intercellular Contacts (iBLINC) (Desbois et al., 2015) (Figure 1A). In the case of electrical synapses, innexins can be endogenously tagged with fluorescent proteins to visualize homomeric or heteromeric electrical synapses (Hendi et al., 2022; Gordon et al., 2020; Bhattacharya et al., 2019) (Figure 1A). These tools have been somewhat constrained by the relative paucity of cell-specific promoters, but recent single cell RNA-sequencing studies (Taylor et al. 2021, Packer et al. 2019) have yielded novel cell-specific promoters for driving fluorescent proteins in neurons which previously lacked sparse- expressing genes. Moreover, the relative ease of labeling endogenous genetic loci with a fluorophore using CRISPR/Cas9 (Eroglu, Yu, and Derry, 2023; Ghanta et al., 2021; Ghanta and Mello, 2020) has led to an increase in reporters with fluorophore-tagged proteins localized at chemical and electrical synapses (Zhou et al., 2021; Bhattacharya et al., 2019; Lipton, Maeder, and Shen, 2018; Tu et al., 2015; Pinan-Lucarré et al., 2014). With these advances over the years, the C. elegans community has built a growing, but still very limited, collection of synaptic reporters. These reporters have been instrumental in studying synapse biology in abundant paradigms including, but not restricted to, synaptogenesis (Mizumoto, Jin, and Bessereau, 2023; Kurshan and Shen, 2019; Jin, 2005), sexual dimorphism (Pechuk et al., 2022; Salzberg et al., 2020; Bayer et al., 2020, 2018; Cook et al., 2019; Hart and Hobert, 2018; Weinberg et al., 2018; Oren-Suissa, Bayer, and Hobert, 2016), and experience-dependent plasticity (Chandra et al., 2023; Bhattacharya et al., 2019; Bayer et al., 2018; Hart and Hobert, 2018). A toolkit of novel reporters is presented in this paper as a resource for the C. elegans community (Figure 1B, Supplementary table 1).
To complement the synaptic reporters and facilitate their proper scoring, we have developed an image analysis pipeline called Worm Punctate Synapse Quantifier, or WormPsyQi, which uses machine learning to process and extract useful biological data from a large number of images in an automated, unbiased, and robust manner. By running WormPsyQi on many image datasets of published as well as new synaptic reporters we have developed in the lab (Figure 1B), we show that the pipeline can be generalized to synaptic fluorescent reporters of many types, neurons with diverse morphologies, and images taken by multiple users using different microscopes and imaging parameters.
The toolkits described in this paper (strains and imaging pipeline) mitigate several ubiquitous problems related to manual counting of puncta in large datasets. These include, but are not limited to, difficulty in scoring synapses in synapse-dense regions such as the somatic and pharyngeal nerve rings, user bias, human error, problems stemming from scoring images with low signal-to-noise ratio or in regions with high background autofluorescence, laboriousness of scoring large datasets and puncta features such as size and intensity, and inter-dataset variability. We anticipate that the toolkits presented here will provide a motivation for the C. elegans research community to continue to build more synaptic reporters and to engage in an analysis of the vast number of presently unstudied synaptic connections in the C. elegans nervous system.
Results and discussion
Generating a semi-automated and robust pipeline for scoring synapses
A key advantage that fluorescent reporters provide over traditional EM-based approaches is that they allow a high-throughput and quick visualization of synapses. However, an ensuing limitation is the quantification of synapse number and ultrastructure. These include plainly obvious features such as the number of synaptic puncta, but also at first indiscernible features such as relative size, fluorescence intensity, and spatial distribution of puncta along a neuron’s processes.
Manual synaptic puncta quantification in large image datasets can be problematic (San-Miguel et al., 2016; Crane et al., 2012). Firstly, it is tedious and low in throughput; for neurons with high synapse density and complex cell morphology in three-dimensional (3D) space, it can take up to several hours to quantify a typical dataset. Secondly, manual quantification requires some a priori information about the region of interest (ROI), thus discouraging observation outside the ROI, which may be of relevance in different genetic or environmental backgrounds. In addition, subtle features may escape manual quantification altogether, possibly hindering their use as a proxy for measuring neuron-specific synapse properties and impeding a comprehensive understanding of pathways which mediate precise synapse distribution. Lastly, manual quantification introduces human error and bias in cases where the fluorescent signal is dim, synapse density is high, the signal-to-noise ratio is poor, or if neurons have complex morphologies which obstruct manual counting in a 3D image stack. These problems are further compounded by dozens of labs generating various synaptic reporters and using distinct microscopes and imaging parameters, all that currently prevents datasets from being easily interpreted, reproduced, shared, and reused. These reasons also partially explain why we cannot rely exclusively on existing image analysis software optimized for other types of datasets or other model organisms.
To address some of these challenges, we have developed a semi-automated computational pipeline, WormPsyQi, to score synaptic puncta in C. elegans in a high- throughput manner and with reduced bias. The pipeline is accompanied by a Python- based graphical user interface (GUI) that allows users to seamlessly move through each step and process large volumes of data (Figure 2 – figure supplement 1B), which greatly reduces the barrier to use. WormPsyQi consists of five key steps: neurite mask segmentation (optional), synapse segmentation, validation and correction, re- labeling and training (optional), and quantification (Figure 2A – figure supplement 1A). First, we obtain a neurite mask. Many image datasets include channels for both synaptic and cytoplasmic markers, and the latter helps exclude noise or autofluorescence signals from other tissues (e.g., the intestine). For neurite segmentation, we modified a convolutional neural network architecture, U-Net (Guo et al., 2022; Guo et al., 2020; Ronneberger, Fischer, and Brox, 2015), to robustly segment the neurite and soma, and create a mask which narrows down the ROI in which synapses are identified in later steps (Figure 2 – figure supplement 2A). Masking prior to synapse segmentation is critical if the signal-to-noise ratio is poor and to significantly reduce the overall image processing time by constraining synapse segmentation to the neurite mask.
After masking, a local feature-based pixel classification model segments synaptic pixels inside the neurite mask (Figure 2 – figure supplement 2B). In the absence of a neurite mask, the pipeline will indiscriminately segment all puncta within the image. We provide both pre-trained (or default) models and an option for users to train custom synapse segmentation models. Image datasets from four diverse synaptic reporters were used to train four independent default models optimized to detect 1) small synapses (1-3 pixels radius) with low SNR (e.g., puncta with similar intensity and morphology as autofluorescence noise in surrounding tissue), 2) small synapses with high SNR, 3) medium-sized synapses (3-10 pixels radius), and 4) diffuse (>10 pixels radius) signal (see Methods for more detail). These pre-trained models can reliably cover various types of reporters, cells, and imaging parameters as discussed in later sections (Figures 3-7). To facilitate the model choice, there is an option for users to test all models on representative images, validate which model works best, and proceed with processing the entire dataset using the optimal model. In addition to this, the GUI enables users to review and edit the synapse segmentation results (Figure 2 – figure supplement 1C), as well as to train a custom model by using training data (coupled images and manual annotations of these images – for details, see Github documentation). In our experience, as few as one fully labeled image stack in the training set is sufficient for the segmentation accuracy to converge (Figure 2C).
Finally, WormPsyQi also quantifies features of predicted synapses and returns individual and summarized image- and synapse-specific features in a CSV file format, facilitating further statistical analysis. This quantification process not only yields synapse counts (Figure 3-10), but also provides metrics more challenging to discern visually. These metrics include total and average synapse volumes, spatial density of synapses, and fluorescence intensity (Figure 10). Such comprehensive analysis can enable in- depth analysis across different developmental stages, genetic strains, or imaging conditions. Altogether, WormPsyQi is an ‘image-in-data-out’ pipeline for quantitative analysis of synaptic puncta in fluorescent images.
WormPsyQi reliably scores synapse features and expedites analysis relative to manual scoring
To evaluate WormPsyQi’s segmentation accuracy and precision, four independent experimenters (Figure 2D, inter-expert), manually annotated a dataset of six images, pixel-by-pixel, in which presynaptic specializations of the pharyngeal neuron I5 were labeled with GFP::CLA-1. Training models were constructed from subsets of the dataset and their performance was tested on the remaining images (Figure 2D). We selected the intersection over union (IoU) between expert labels and WormPsyQi’s prediction compared to inter-expert label similarity to benchmark the segmentation performance. Notably, the IoU between WormPsyQi’s segmentation and the original labeler’s annotation was significantly higher than the inter-expert IoU (Figure 2D, columns 2 and 3), indicating that WormPsyQi allows standardized quantification of synaptic features which human annotators cannot. Importantly, our results show that the WormPsyQi model trained on one image is as good as the one trained on five, indicating that even without using a pretrained model, WormPsyQi can save time spent on annotating synaptic images. When comparing the predictions of WormPsyQi (trained with one expert’s labeling) to the labels of other experts, the IoU scores were found to be comparable to the inter-expert IoU (Figure 2D, columns 4 and 5).
To assess the WormPsyQi vs. human labeler effect size, we next sought to compare the discrepancy between WormPsyQi scoring and scoring by two independent human annotators (Figure 2 – figure supplement 3). Based on our analysis of I5p::GFP::CLA-1 and M4p::GFP::RAB-3, we found that the effect size was reporter- dependent: for I5 CLA-1, where the puncta were discrete and S/N ratio high, inter- labeler discrepancy and WormPsyQi vs. human (labeler 1 or 2) discrepancy was low. Conversely, the discrepancy across all three scoring methods was high for M4p::GFP::RAB-3, which is a synapse-dense strain with less discrete signal; in this case, semi-automated scoring averaged out human-to-human scoring differences, but did not significantly improve the segmentation.
Lastly, we compared the quantification of additional puncta features such as puncta volume, distribution along the neurite, and overall processing time. To do so, we focused on the ASK GFP::CLA-1 reporter (Figure 2 – figure supplement 4). We found that the difference between quantification of puncta number, volume and distribution using WormPsyQi vs. two independent human annotators is statistically insignificant, and that our pipeline reduces quantification time to a large extent (Figure 2 – figure supplement 4E). This is especially true for quantifying subtle features such as size, volume, and intensity, which may not be immediately obvious features and are much more laborious to quantify manually compared to puncta number, because pixel-wise annotation is necessary. Our analysis, therefore, suggests that the algorithm is competent in recapitulating human labeling (in some cases averaging inter-labeler variability) of not just puncta number but also other features, significantly expedites scoring, and can therefore be used to replace manual scoring. The robustness of puncta quantification is further corroborated by comparing WormPsyQi vs. manual quantification for many strains in ensuing sections (Figure 4 – figure supplement 1, Figure 5).WormPsyQi vs. manual quantification for many strains in ensuing sections (Figure 4 – figure supplement 1, Figure 5).
WormPsyQi validates sexually dimorphic synaptic connectivity
To demonstrate that our pipeline can quantify synaptic puncta in a robust manner, we initially set out to validate sexual dimorphic synaptic connectivity in the C. elegans nervous system. Whole-nervous system EM reconstruction in C. elegans adult males and hermaphrodites shows that many ‘sex-shared’ neurons - neurons present in both sexes - display sex-specific, i.e., sexually dimorphic synaptic connectivity patterns (Cook et al. 2019). In previous studies, a small subset of these dimorphic synapses was visualized with GRASP- or iBLINC-based transgenic reporters (Pechuk et al., 2022; Salzberg et al., 2020; Cook et al., 2019; Weinberg and Hobert, 2018; Bayer and Hobert, 2018; Oren-Suissa, Bayer, and Hobert, 2016). By scaling the analyses, presently extremely laborious with EM, these reporters have been indispensable for not only substantiating EM data, but also for understanding the molecular determinants underlying dimorphic circuits and the pathways mediating plasticity (Goodwin and Hobert, 2021 and references therein). In addition, the ability to visualize a specific synapse across many animals continues to reveal new insights such as the extent of variability in synaptic number and spatial distribution across animals, which was previously unappreciated in the absence of tools and sufficient EM samples to study it.
To validate these findings using WormPsyQi, we honed in on four synaptic connections between sex-shared neurons: PHB>AVA, PHA>AVG, PHB>AVG, and ADL>AVA. In all cases, previous studies have shown sex-specific differences in these connections after sexual maturation (Figure 3A) (Cook et al. 2019; Oren-Suissa, Bayer, and Hobert, 2016). We show here that WormPsyQi reliably validates previous observations: synapses between ADL>AVA, PHB>AVA, and PHA>AVG are sexually dimorphic, such that synapse number in adult males is less compared to hermaphrodites, and PHB>AVG synapses are less in adult hermaphrodites compared to males (Figure 3B-E). An added advantage compared to previous manual puncta quantification was that WormPsyQi expedited the quantification by largely automating the process and, importantly, relied on a single pre-trained segmentation classifier to robustly quantify synaptic number across all four reporters. Together, the performance on these test cases encouraged us to further explore the efficacy of our pipeline in a more systematic manner.
An expanded toolkit to visualize synapses in C. elegans
Having established that WormPsyQi works on a handful of synaptic reporters, we sought to further explore its efficacy in facilitating unbiased synapse quantification. The aforementioned sexually dimorphic reporters (Figure 3) are all GRASP- or iBLINC- based and target only 5 neuron classes - most making synapses in the C. elegans tail - of the total 116 sex-shared classes in hermaphrodites (White et al., 1986). We asked if our pipeline could quantify various types of punctate signals across other reporter types and in other regions of the nervous system, particularly the nerve ring which comprises the bulk of the hermaphroditic C. elegans connectome (Brittin et al., 2021; Cook et al., 2019; White et al., 1986). Despite this preponderance, the nerve ring is remarkably under-studied largely due to a lack of tools available to visualize and reliably quantify synapses in the most complex and synapse-dense region of the C. elegans nervous system. This is generally true for synapses in the somatic or central nervous system, compared to neuromuscular junctions, which are easier to visualize and for which relatively more reporters are available.
To broaden the existing resource of synaptic reporter strains, we generated novel synaptic marker strains. These include cell-specific CLA-1 reporters for 8 neuron classes (Figure 4) and 5 new GRASP reporters (Figure 5) which label specific synapses between multiple neuron classes. Considering both new and previously existing reporters, we describe synaptic reporters for almost 30 neuron classes in both the central and pharyngeal (= enteric nervous systems) of C. elegans (Figure 1; Supplementary table 1). Many of the new reporters described here target neurons which make synapses in the nerve ring, including cell-specific reporters for IL1, ASK, ADL, RIB, AIA, BDU, HSN (first published in Leyva-Díaz and Hobert, 2022), IL2 (first published in Cros and Hobert, 2022) (Figure 4). These efforts relied on the presence of cell-specific promoters driving GFP expression drawing from previous studies. The recent availability of single cell RNA sequencing (scRNAseq) data driven by the CeNGEN project (Taylor et al., 2021) opens up opportunities to gain even broader coverage.
WormPsyQi is generalizable across a wide array of synaptic reporters in the central nervous system (CNS)
Previous synapse quantification approaches in C. elegans focused on neurons with relatively simple trajectories along the anterior-posterior axis in one plane on the dorso-ventral axis (e.g., en passant synapses along the ventral nerve cord). These include semi-automated (San-Miguel et al., 2016; Crane et al., 2012) and manual approaches such as counting synaptic puncta by hand or drawing plot profiles (line scans) of fluorescent signals along a neurite using open-source image processing software such as Fiji/ImageJ, often combined with synapse enrichment quantification as assessed by fluorescence (Kurshan et al., 2018; Xuan et al., 2017; Jang et al., 2016; Dittman and Kaplan, 2006). These methods are well-suited for quantifying synapses along linear neurites but pose problems in neurons with morphologically complex anatomies in 3D space. We thus wanted our pipeline to be able to easily quantify synapses in other types of neurons in C. elegans.
In addition, a key observation based on many synaptic reporters imaged by different researchers using diverse microscopes, on different days, and at various life stages and across sexes, is that images collected from these reporters are perceptibly heterogeneous depending on the type of fluorophore-tagged synaptic protein, choice of promoter driving the fluorophore, and the labeling method used. For instance, cell- specific RAB-3 reporters have a more diffuse synaptic signal compared to the punctate signal in CLA-1 reporters for the same neuron, as shown for the neuron pair ASK (Figure 4 – figure supplement 1C) and observed previously in other neurons (Cook et al., 2020; Lipton, Maeder, and Shen, 2018; Xuan et al., 2017). This is intuitive based on the distinct localization and function of RAB-3, a presynaptic vesicle protein (Nonet et al., 1997), and CLA-1/Piccolo, an active zone scaffolding protein which recruits synapse vesicles to release sites (Xuan et al., 2017). We note that this is not a consequence of tagging RAB-3 on a specific terminal, since both N- and C-terminal RAB-3 fusions manifest diffuse signal compared to CLA-1. While this may not be a problem for neurons or regions with low synapse density (e.g. ASK RAB-3 and CLA-1 puncta number are similar as shown in Figure 4 – figure supplement 1C), it poses challenges for synapse-dense cases such as AIB and SAA, where WormPsyQi is unable to reliably segment puncta using any of the four pre-trained models. Lastly, within a reporter type, fluorescent signals appear similar, as demonstrated by the similarity of punctate fluorescent signal between various CLA-1 reporters (Figure 4A). This is useful because it allows the use of a single pre-trained model for multiple use cases.
In contrast to the relative signal homogeneity in presynaptic fluorophore-tagged reporters of the same kind, signals across reporters that make use of transsynaptic technologies can vary. Fluorescent signal from GRASP and iBLINC reporters appears different from other reporters and is wide-ranging across neurons or synapses (Figure 5). As previously reported, this is likely due to transsynaptic labeling methods being more sensitive to the choice of promoters used to drive split-fluorophore fragments, amount of injected reporter DNA, extrachromosomal vs. integrated nature of transgenes, and imaging conditions (Oren-Suissa et al., 2016). Consequently, quantifying the signal of such wide-ranging reporters has been challenging and requires expert knowledge, which is not always transferable across researchers and labs, and introduces human bias and error.
To address these concerns, we used WormPsyQi to quantify puncta in representative datasets for many different presynaptic (Figure 4) and transsynaptic (Figure 5) reporters for neurons in the central nervous system. We first trained reporter type-specific synapse classifiers (see Methods) to aid quantification so that an average user does not need to perform the tedious step of labeling and training datasets for common types of reporters available in the community. Next, we systematically ran the image datasets through our pipeline, making use of neurite masking (where available) prior to synapse segmentation and quantification (Figure 2 – figure supplement 1; Figures 4, 5). Analyzing many reporters further validated that WormPsyQi was able to detect synaptic puncta with minimal human contribution and across a wide range of reporter types (Figures 4, 5).
To confirm that WormPsyQi was quantifying fluorescent puncta accurately, we compared its results with manual quantification for a subset of reporters analyzed and found that in most datasets, the difference between WormPsyQi and human annotation was statistically insignificant (Figure 4 – figure supplement 1A, Figure 5). In cases where our pipeline could not recapitulate manual scoring, the masking step was either skipped prior to segmentation (PHB CLA-1) or synapse density was too high (IL1 CLA- 1). In the case of IL1 CLA-1, training a reporter-specific classifier, such as in the case of IL1 (Figure 4 – figure supplement 1) improved the results. Generally, having a cytoplasmic reporter in the background of the synaptic reporter enhanced performance; it was also a crucial step in preventing synapse mis-annotation in regions with high background fluorescence intensity such as the tail, where adjacent intestinal autofluorescence typically masks bona fide synaptic signal. This is demonstrated in the case of PHB>AVA GRASP puncta quantification (Figure 4 – figure supplement 1B), where WormPsyQi erroneously segments gut autofluorescence puncta as synapses in the absence of a cytoplasmic reporter.
We also found that CLA-1 reporters were overall a superior marker as compared to RAB-3 reporters for the same neuron, as shown for ASK (Figure 4 - figure supplement 1A, C). In both cases, WormPsyQi could segment puncta, but the signal was much more discrete, and synapses were resolved better in the ASK CLA-1 reporter. In the case of ASK, overall puncta number in L4 animals was similar in both RAB-3 and CLA-1 reporters but the mean puncta area was much greater in the case of RAB-3, corroborating the diffuse signal which poses quantification challenges for neurons with greater synapse densities, e.g. AIB (Figure 4 - figure supplement 1D). We also note that the difference in diffuse vs. discrete signal could not be attributed to the transgenic reporter type (integrant vs. extrachromosomal) since both types of CLA-1 reporters had discrete, smaller puncta compared to RAB-3; owing to variable expressivity in the CLA-1 extrachromosomal reporter, however, fewer puncta could be quantified (Figure 4 - figure supplement 1C). Lastly, in some reporters (Figure 4 - figure supplement 1D), such as those for RME-specific SNB-1, SAA-specific RAB-3, and AIB-specific RAB-3, WormPsyQi could not effectively segment synapses because the signal was too diffuse and synapse density, in the case of AIB, too high. Again, relying on alternative reporters where possible, such as the CLA-1 based reporter for AIB (Figure 4A) which is much better resolved and has distinguishable puncta, is recommended.
In some cases (e.g. AIB>SAA in Figure 5), there was discrepancy between WormPsyQi and manual quantification because the signal intensity of puncta was too low to be quantified comprehensively using our pipeline. The analysis of puncta is ultimately influenced by the limits of light microscopy and that the images being analyzed must be of good quality before they are fed into the pipeline. In cases where these issues cannot be resolved during data acquisition, further improvement may be achieved by using alternative microscopy methods, reporter types, or brighter fluorophores. We also note that in several cases, GRASP quantification differed from EM scoring (Figure 5). In the absence of a comparable EM sample size in any paradigm tested, it is impossible to assess whether the difference is statistically significant. We note that differences between light-microscopy based imaging and EM are anticipated particularly in synapse-dense regions where our fluorescent reporters, imaging cannot resolve individual synapses as well as EM analysis does.
WormPsyQi performs robustly in morphologically diverse pharyngeal neurons
In addition to the somatic or central nervous system described thus far, C. elegans contains a pharyngeal or enteric nervous system (ENS) which resides entirely in the pharynx, or the feeding organ (Avery and You, 2012; Mango, 2007; Albertson and Thomson, 1976). Unlike the CNS, the dynamics of synaptic connectivity in the ENS are even less explored. Previous EM reconstructions of the pharynx (Cook et al., 2020; Albertson and Thomson, 1976) serve as excellent starting points but, again, we are confronted with limitations such as a very small sample size and a lack of means to study how synapses in the pharynx are established and altered in larval development, as well as under various perturbations.
The C. elegans pharynx constitutes 14 neurons classes, and like the ENS in other organisms (Brehmer, 2021; Furness et al., 2007; Costa, Brookes, and Hennig, 2000), there is substantial morphological heterogeneity among these neuron classes (Albertson and Thomson, 1976). In addition, some neurons show variability in branching and synapses, both within a bilateral pair and across individuals, such as in the case of M3 L/R pair (Albertson and Thomson, 1976). This diversity and variability in form poses an additional challenge for image processing, particularly in masking neurites using conventional software. We thus asked if WormPsyQi could create neurite masks of diverse pharyngeal reporters, and subsequently score colocalized synaptic puncta. Cell- specific CLA-1::GFP synaptic reporters of several pharyngeal neuron classes were recently developed, cell-specifically labeling presynaptic CLA-1 in neurons NSM, I1, I2, I5, and MC (Cook et al., 2020). In addition, we describe here two RAB-3::GFP reporters which label presynaptic RAB-3 in neurons M3 and M4 to altogether cover 7 neuron classes in the pharynx (Figures 6, 9; Supplementary table 1). We also analyzed a pan-pharyngeal reporter in which presynaptic CLA-1 in all 14 pharyngeal classes is visualized with GFP (Figure 6 – figure supplement 1) (Vidal et al., 2022).
Our analyses show that WormPsyQi can robustly segment pharyngeal neurites and generally performs well in quantifying synapses, as with the CNS. This is shown by the comparison between manual and WormPsyQi counts for each reporter (Figure 6A- F). In reporters for neurons I5, MC, NSM, and I2, we found no significant difference between puncta count measured by the pipeline versus a human annotator (Figure 6A- D). In two reporters, there was a discrepancy between WormPsyQi and human quantification. In the case of the M4 RAB-3 reporter, the RAB-3 signal was too diffuse to resolve all puncta (Figure 6F); in reporters for neurons with high synapse densities, such as I1-specific CLA-1 reporter (Figure 6D) and pan-pharyngeal CLA-1 reporter (Figure 6 - figure supplement 1), some puncta were not detected by the pipeline. In the case of the pan-pharyngeal reporter, WormPsyQi detected most puncta consistently (reflected in varying standard deviation: S.D. = 4.2 for posterior bulb, S.D. = 29.2 for total count) in the synapse-sparse posterior bulb compared to overall puncta for all pharyngeal neurons (Figure 6 - figure supplement 1). We expect that presence of a sparse cytoplasmic marker in the background – which would allow using sparse neurite masking before synapse segmentation in WormPsyQi – or alternative labeling strategies would improve results. Finally, we note that there is a marked discrepancy between puncta count in our reporters compared to EM data (Figure 6); while the low sample size of EM (n = 1) prevents us from doing any statistical analyses, reasons for plausible differences are explored in the discussion section.
WormPsyQi can quantify and scale the study of electrical synapses
Although connectomics has historically been biased towards chemical synapses, expression studies on the localization of key electrical synapse components - innexins in invertebrates and connexins/pannexins in vertebrates - suggest the presence of complex connectivity patterns (Ammer et al., 2022; Bhattacharya et al., 2019; Feigenspan et al., 2004; Lee et al., 2003). This is strengthened by evidence of gap junctions in ultrastructural EM-based analyses in both invertebrates (Cook et al., 2019; Jarrell et al., 2012; White et al., 1986) and vertebrates (Smedowski et al., 2020; Anderson et al., 2011), as well as expression studies showing cell type-specific and tissue-specific spatial patterns of innexin and connexin genes (Bhattacharya et al., 2019). In addition, studies involving perturbations of innexins and connexins have shown diverse contributions of electrical synapses to neuronal function (Hendi et al., 2022; Bhattacharya et al., 2019; Hall, 2017; Song et al., 2016; Meng et al., 2016; Kawano et al., 2011; Bloomfield and Völgyi, 2009; Yeh et al., 2009; Chuang et al., 2007).
While the accepted standard for scoring chemical synapses is EM reconstruction, scoring electrical synapses using EM has proven more challenging. EM analysis relies heavily on unambiguous detection of synapse densities; unlike chemical synapses, electrical synapses are more sensitive to EM sample preparation and affected by discrepancy among annotators. Thus, a complete electrical synapse connectome is lacking in any model system to date and remains a difficult endeavor despite ongoing troubleshooting efforts (Emmons, Yemini, and Zimmer, 2021). This makes it even more pressing to develop non-EM based approaches to study gap junctions. Unlike chemical synapses, which are visualized by using transsynaptic labeling or individually tagging pre- and post-synaptic proteins, electrical synapses can be directly visualized by endogenously tagging junction-forming innexins, which assemble into hemichannels in pre- and post-synaptic regions before forming gap junctions via complementary matching between opposing hemichannels (Figure 1) (Goodenough and Paul, 2009).
To analyze datasets for electrical synapses using WormPsyQi, we focused on a sparsely expressed innexin reporter, INX-6::GFP (Bhattacharya et al., 2019) (Figure 7). WormPsyQi was able to segment and quantify puncta using the default classifier (based on CLA-1 trained images). INX-6::GFP puncta were observed in the pharynx and the nerve ring region, with more puncta scored in dauers compared to well-fed L4 animals b(Figure 7). A subset of these puncta represents de novo gap junctions between AIB and BAG neurons which mediate dauer-specific chemosensory behavior (Bhattacharya et al., 2019).
Quantitative analysis of synapses across development in the central nervous system
Synapse plasticity takes multiple forms - such as synapse addition at pre-existing synaptic sites, pruning, and establishment of de novo synapses – and is essential for shaping neuronal circuits and behavior. Intuitively, synapse addition likely prevails circuits building up to meet the needs of a growing animal but this surmise is only recently being confirmed and still remains sparsely understood. Most studies describing synapse addition use EM-based approaches and rely on a small sample size. An obvious pitfall of this is that resulting low-throughput datasets preclude distinguishing synapse plasticity across life stages from baseline inter-individual variability. While expanding EM analysis to study larger sample sizes would be an ideal solution, simply relying on transgenic reporters and the high-throughput analyses they enable could facilitate studying synaptic plasticity in light of variability.
In this paper, we used our toolkits to explore how synaptic puncta change in a small subset of neurons by comparing the number of puncta between early larval and adult stages (Figure 8). From our analysis, we found that generally neurons in the CNS progressively add synapses at pre-existing sites throughout larval development up until adulthood (Figure 8B-E). For synapses studied in detail (ASK>AIA, PHB>AVA, and AIB>SAA visualized with GRASP, and ASK CLA-1), puncta number steadily increases between early larval and L4 or adult stages. In the case of ASK, synapse addition – shown for all presynaptic specializations visualized with GFP::CLA-1 (Figure 8B) and for ASK>AIA synapses (Figure 8C), AIA being ASK’s major postsynaptic partner (White et al., 1986) – occurs roughly in scale with the increase in neurite length (Figure 8A) in the nerve ring; specifically, there is a ∼2-fold increase across all three measures. In a previous study, a comparative analysis of the nerve ring from samples spanning multiple larval- and adult-staged C. elegans showed that systemwide neurite length increases with the length of the animal and that synapses are added progressively thereby maintaining overall synapse density (Witvliet et al., 2021). Since this was done on a systemic scale, albeit with a small sample size, the study noted that synapse addition was likely a cell-specific feature with some neurons adding or pruning more synapses than others (Witvliet et al., 2021). Notably, ‘hub’ neurons added disproportionately more synapses across development. Similarly, a subset of neuron classes that undergo stage-specific plasticity (Witvliet et al., 2021) and/or synaptic pruning with the onset of sexual maturation (some examples are shown in Figure 3) remove synapses in a stage- and cell-specific manner.
Uniform synapse addition has also been noted in sparse EM-based comparative connectomic studies in other systems, such as the nociceptive circuits in D. melanogaster between first and third instar larval stages (Gerhard et al., 2017), motoneurons in D. melanogaster across larval development (Couton et al., 2015), antennal lobe in D. melanogaster between late pupa and adulthood (Devaud et al., 2003), and primary somatosensory and visual cortical regions in mice and rhesus macaque during early postnatal development (Wildenberg, Li, and Kasthuri, 2023). Importantly, since our approach is high-throughput, it allows us to ascertain synapse addition while accounting for inter-individual variability in synapse number in the reporters studied. This is a key point which remains hard to address with current EM output, but focusing on a ‘core’ set of synapses present across EM samples (Cook et al., 2023) presents an opportunity for statistically-powered analyses.
Quantitative analysis of synapses across development in the enteric nervous system
Synapse addition may be widespread but it is not ubiquitous when studied at the level of neuron class or region of the nervous system. To broaden our analysis of developmental plasticity in C. elegans, we next focused on neurons of the ENS. The length of the pharynx from the tip of the corpus to the end of the terminal bulb increases 2-fold (from 60μm to 130μm, roughly) between L1 and adulthood (Shibata et al., 2016); this elongation is modest relative to the overall ∼4.5-fold increase (from 250μm to 1150μm, roughly) in the length of the animal across the same developmental window (Witvliet et al., 2021; Shibata et al., 2016) (Figure 9A). To investigate how neuronal processes and presynaptic specializations of pharyngeal neurons scale with the elongation of the whole organ, we quantified neurite length (denoted by ‘Length of ROI’) and the number of fluorescently-tagged CLA-1 or RAB-3 puncta in the pharyngeal neuron classes MC, M3, I2, M4, and NSM (Figure 9B-F). In this case, puncta were counted both manually (Figure 9) and using WormPsyQi (Figure 9 – figure supplement 1). Due to high synapse density and lack of or faint expression of a cytoplasmic reporter in most strains analyzed, WormPsyQi undercounted puncta in early larval stages (Figure 9 – figure supplement 1). However, trends in developmental plasticity between manual and automated quantification were similar (Figure 9 – figure supplement 1).
We found that in contrast to neurons in the CNS, neurons in the ENS show striking disparity in synapse addition across neuron classes. The number of CLA- 1/RAB-3 puncta in neurons MC, I2, and M3 remains constant (neurons MC and I2, Figure 9B, C; Figure 9 – figure supplement 1A, D) or increases modestly compared to the elongation of the pharynx (neuron M3, Figure 9D; Figure 9 – figure supplement 1B) between early larval stages (L1 or L2) and adulthood. This is in spite of the neurite length scaling roughly in line with the length of the pharynx in all three cases (Figure 9B-D). In other words, synapse density in these neurons decreases across development. We note that in some neurons, such as M3 (Figure 9D) (Albertson and Thomson, 1976), it is possible that the large variability in synapse number across individuals and within a bilateral pair, at a given stage in development, may complicate comparative analysis between stages. Furthermore, since our analysis does not include quantification of neuronal adjacency across development, we cannot rule out the possibility that physical contact within neighborhoods of pharyngeal neurons which make synapses with one another is not scaling with the elongation of the pharynx or the whole animal. EM reconstructions, because of their often system-wide nature, may be better-suited for this type of analysis since it yields quantification of both the connectome and the adjacencies, or ‘contactome’, between synaptic partners.
In contrast to neurons which show variable synapse density across ages, we found two neuron classes, M4 and NSM, where CLA-1/RAB-3 puncta are added proportionately with increasing neurite length and overall pharynx elongation across development (‘Total count’ in Figure 9E, F; Figure 9 – figure supplement 1C). Our CLA-1-based data for NSM also corroborate previous findings of the developmental trajectory of NSM’s synaptic branches (Axäng et al., 2008). Based on previous EM studies (Cook et al., 2020; Albertson and Thomson, 1976), these puncta largely correspond to neuromuscular junctions, many of which arise post-embryonically and can be considered somewhat separate from the ‘core’ pharyngeal connectome established in the embryo which seems more static. To take a deeper look, we calculated M4 and NSM puncta number separately in the pharyngeal nerve ring and isthmus, and we found synapse addition between L1 and adulthood in both regions (Figure 9E, F). Given the density of puncta in the nerve ring, it is ultimately difficult to discern change in neuron-to-neuron synapses made by these neurons by relying solely on CLA-1/RAB-3 reporters. Synapse-specific reporters built using GRASP/iBLINC or temporal EM analysis will offer greater resolution needed to fully understand developmental plasticity in these synapse-dense regions. In conclusion, synapse addition appears to differ between the ENS and CNS, as suggested by the lesser increase in synapse number in pharyngeal neurons relative to somatic neurons in our data (Figures 8, 9).
Using WormPsyQi to extract subcellular information of synapse distribution
Next, we exploited PsyQi to extract subcellular information of synapse distribution. To this end, we quantified spatial positions of presynaptic specializations in neurons PHA, AIB, and ASK as proof of principle (see Methods). We found that the presynaptic reporter data recapitulated expected subcellular distribution patterns in all three neurons analyzed. Previous EM data (Cook et al., 2019; White et al., 1986) shows that in PHA neurons, presynaptic sites are concentrated - and uniformly distributed – in the axonal region anterior to the branch point with close to zero synapses posterior to it; our PHA-specific RAB-3 reporter recapitulates this topological distribution (Figure 10A). Taking advantage of our sizeable dataset (n = 17 compared to EM, n = 1) which represents an ‘average’ population of worms, we took the analysis a step further and measured the probability of finding a synapse at a particular location along the axon, thus quantitatively showing the distribution of stereotyped (high probability density) and variable or noisy (low probability density) sites; we found that distribution was indeed more or less uniform in the case of PHA in spite of inter-individual variability (Figure 10A, Figure 10 – figure supplement 10A).
We performed a similar analysis on CLA-1 based reporters for neurons AIB and ASK (Figure 10). AIB’s axons occupy two distinct neighborhoods of the nerve ring (Moyle et al., 2021), anterior and posterior, with a majority of presynaptic sites localizing in the anterior region (Sengupta et al., 2021). Both RAB-3 (Sengupta et al., 2021) (Figure 4 – figure supplement 1D) and CLA-1 (Figure 4A, Figure 10B) reporters for AIB qualitatively show this distribution. Quantification of topological synapse distribution within the anterior axon in a representative population revealed that synapse density is sparse in the ventral regions, but increases gradually as the processes travel to the crossover point at the dorsal midline, with highest density proximal to it. We also observed widespread variability in puncta size that could not be correlated with spatial location (Figure 10 – figure supplement 1B). Lastly, in the case of ASK neurons, EM data shows (White et al., 1986) distinct regions along the axons where synapses localize. Our RAB-3 (Figure 4B) and CLA-1 (Figure 4A, Figure 10C) recapitulate this distribution pattern in a representative population. We found that ASK axon regions differed markedly in absence or presence of a synapse as well as stereotyped vs. variable sites as denoted by the distinct peaks in the estimated probability density plot (Figure 10C).
Having earlier quantified the developmental plasticity of synapse number in ASK neurons between L1 and adulthood (Figure 8), we next asked how the stereotyped topological distribution and synapse ultrastructure features (such as synapse volume) change across development. The total volume of synapses scaled proportionately with synapse addition between L1 and adult animals (Figure 10D), and peaks in probability density were stereotyped as well (Figure 10E), suggesting that these ultrastructure and spatial quantifications followed the same extent of plasticity as the overall number of synapses did. In addition, we plotted the number of puncta against ultrastructure features including mean volume and mean intensity, and found that mean volume, in the ASK>AIA reporter studied in detail, clustered in an age-dependent manner; conversely, the synapse density vs. mean intensity feature space did not show any age- dependent clustering (Figure 10 - figure supplement 2).
Although this analysis is limited to a few neurons, the observation that synapse distribution - for synapses that are present at birth - remains stereotyped is not unanticipated given that, aside from inter-individual variability, the overall architecture of the brain in terms of cell body positions, neuronal morphologies, and relative arrangement of processes within neighborhoods in C. elegans are largely maintained across development (Witvliet et al., 2021; Moyle et al., 2021; Brittin et al., 2021). An exception to this organizational stereotypy is a subset of neurons that undergo drastic changes across one or several of these spatial features between L1 and adulthood, such as birth of new neurons (e.g. VNC neuron classes), migration of cell bodies (e.g. HSN, ALM), dendritic growth (e.g. FLP, PVD, NSM), synapse pruning (e.g. sexually- dimorphic neurons PHB, AVA etc.), and neighborhood change (e.g. DD and VD neurons) (Androwski et al., 2020; Emmons, 2018; Howell, White, and Hobert, 2015; Middelkoop and Korswagen, 2014; Altun and Hall, 2011; Oren-Suissa et al., 2011; Smith et al., 2010; Axäng et al., 2008). Overall, precise quantification of synapse distribution patterns and ultrastructural features on a population level, something that can only be done qualitatively by eye, is a useful way of assigning topological information to reporter-based datasets and can be valuable readouts under various genetic and environmental perturbations, especially in cases where the synapse number may remain unchanged and are uninformative for phenotyping.
Limitations of the toolkits described
We have demonstrated that the toolkits described here enable a high throughput, unbiased, in-depth, and robust workflow for studying chemical and electrical synapses in C. elegans based on analyzing many reporters. However, we note some important limitations. First, the reporters presented here are a proxy for chemical synapses and may represent simply components of synapses. For instance, in the case of GRASP - which relies on split GFP fragments fused usually with Neuroligin/NLG-1 - when two adjacent neuronal processes come in proximity to form a synapse, the fragments are reconstituted and result in fluorescent puncta. Although these puncta suggest synapses and the tool has been instrumental, it is important to note that GRASP specifically visualizes NLG-1 localization and hence the interpretation of puncta number and features quantified with WormPsyQi categorically represent NLG-1 features and dynamics. Intuitively, GRASP would not be ideal for neurons which do not endogenously express NLG-1 at the right time or localize it to synaptic domains, therefore under- or mis-representing the synapse population between two neurons.
Another limitation of the reporters described is that they contain over-expressed multicopy transgenic arrays which could lead to trafficking and localization artifacts. While some of these problems are mitigated by injecting transgenes at different concentrations, integrating extrachromosomal arrays, and testing multiple gene promoters to drive expression, these measures occasionally fail and may introduce a selection bias. In the case of transsynaptic technologies where multiple transgenes need to be co-injected, artifacts tend to be harder to identify and eliminate. Comparisons of multiple reporters expressing an identical transgene often show variability across lines picked from the same injection. This holds true for both presynaptic and transsynaptic reporters although the latter tend to have more variability across lines. This could partially explain discrepancies between data from transgenic reporters and EM reconstructions (Figures 5, 6, 8). With gene editing becoming easier, an increasing collection of reporters with endogenously-tagged proteins known to localize in specific neurons and at specific sites along a neurite will add to our knowledge of pre- and post-synaptically localized proteins available to visualize synapses. Reporters with endogenously-tagged proteins and single-copy transgenes show more consistent expression and spatial localization. Indeed, the use of diverse types of reporters, when available, will be essential to establish the ground truth and inform mutant analyses for advancing our understanding of synapse biology.
Lastly, although we have shown that the image analysis pipeline is robust and versatile, it is constrained by the type of images and reporters being analyzed. In cases where the cytoplasmic marker is suboptimal (e.g. dim cytoplasmic marker in CLA-1 reporters for pharyngeal neurons I2 and NSM, or dim signal on the far end of the cover slip while acquiring images), the resulting neurite mask may be discontinuous, resulting in undercounting of synaptic puncta in downstream steps. In such scenarios, it may be useful to visualize the neurite mask in Fiji prior to synapse quantification. Since this is technical constraint independent of WormPsyQi but can directly affect its performance, we suggest resolving this prior to processing an entire dataset. For instance, one can use a stronger promoter to drive the cytoplasmic fluorophore, perform some preprocessing such as deconvolution, denoising, or contrast enhancement prior to synapse segmentation, or skip the masking step altogether and directly segment synapses. The last scenario is particularly useful in cases where the synapse signal is brighter than the cytoplasmic reporter; for our quantification, we have relied on this for several reporters and denoted them with “no mask” in Supplemental Table 1. We note that the processing time is significantly reduced in the presence of a mask, so if the user decides to skip masking prior to synapse segmentation, we suggest cropping the precise ROI so the quantification can be expedited. Also, where the synapse signal is diffuse (e.g. RAB-3 reporters) or synapse density is too high (e.g. CLA-1/RAB-3 reporters for IL2, NSM, AIB etc., Figures 4, 6), quantification can be inaccurate. Analyzing the “overlay” images saved during image processing can reveal problematic regions of interest and help the user decide whether to proceed with quantification. In general, if the fluorescent signal in an image is visibly discrete, WormPsyQi works well in quantifying many discernible and subtle features which would otherwise be tedious or impossible to achieve.
Material and methods
Strains and maintenance
Wild-type strains used were C. elegans Bristol (strain N2). Worms were grown at 20°C on nematode growth media (NGM) plates seeded with bacteria (E.coli OP50). Details of all transgenic strains are listed in Supplemental table 1; corresponding sex and age are also noted.
Cloning and constructs
All constructs used to build the synaptic reporters are listed in Supplemental table 2. In most cases, subcloning by restriction digestion was performed to generate GRASP, CLA-1, and cytoplasmic (TagRFP, mCherry) constructs. Cell-specific promoter fragments were amplified from N2 genomic DNA and cloned into 5’ SphI- and 3’ XmaI- digested vectors expressing fluorophore only (in the case of cytoplasmic constructs), GFP::CLA-1, GFP::RAB-3, and split-GFP (spGFP1-10, spGFP11) sequences; T4 ligation was used to insert digested promoter fragments into digested vectors. A plasmid containing GFP::CLA-1(S) (PK065) was kindly provided by Peri Kurshan. In some cases, RF-cloning or Gibson Assembly (NEBuilder HiFi DNA Assembly Master Mix, Catalog # E2621L) were used as the preferred choice of cloning. Primers for specific promoter fragments are listed in Supplemental table 2.
Transgenic strains were generated by microinjecting constructs as simple extrachromosomal arrays into N2 or him-5 (e1490) genetic backgrounds. Precise concentrations of co-injected constructs are detailed in Supplemental table 2. Extrachromosomal array lines were selected according to standard protocol. Where integration was performed, gamma irradiation was used.
Microscopy and image analysis
Worms were anesthetized using 100mM sodium azide (NaN3) and mounted on 5% agar on glass slides. Worms were analyzed by Nomarski optics and fluorescence microscopy, using a 40x or 63x objective on a confocal laser-scanning microscope (Zeiss LSM880 and LSM980) or a spinning disk confocal (Nikon W1). When using GFP, we estimated the resolution of our confocal to be ∼250 nm. 3D image Z-stacks were converted to maximum intensity projections using Zeiss Zen Blue or ImageJ software (Schindelin et al., 2012). Manual quantification of puncta was performed by scanning the original full Z-stack for distinct dots in the area where the processes of the two neurons overlap. Figures were prepared using Adobe Illustrator.
Statistical analysis
Statistical tests were performed using Python (version 3.10) or GraphPad PRISM (version 9.5.1). Where multiple tests were performed, post-hoc Bonferroni correction was used to adjust P values for the number of pairwise comparisons made.
Neurite segmentation
Model structure
We adapted a ‘2.5D’ U-Net model (Guo et al., 2020) to segment neurites from 3D fluorescent image stacks. The input is a 3D chunk with dimension 7 x 256 x 256 (D x H x W), and the prediction of the center slice (256 x 256). The chunk that includes nearby slices provides more spatial context compared to 2D segmentation, while reducing the memory constraints of 3D segmentation. The model has an encoding block and a decoding block with skip connections at the same resolution level that “squeeze” 3D into 2D (Figure 2 - figure supplement 2A). The structure of the encoding block is detailed in Figure 2 – figure supplement 2A’.
Training process
The U-Net model was trained using a 3D fluorescent microscopy dataset. The dataset covers 5 neurons from different developmental stages (ASK, AIA, PHB, AVA, I5), with 16 images in total. We split the dataset into the ratio 10:2:4 for training, validation, and testing, respectively. Due to the extremely large size of the original image stack, we sampled each 3D stack randomly into 200 smaller 3D patches as stated above and filtered out the blank background patches using a threshold on mean intensity. For the training process, we used a combination of IoU loss (Berman, Triki, and Blaschko, 2018) and the cross entropy loss: L = LIoU + LCE, with the learning rate set to 0.001. The training usually converges within 200 epochs. Data augmentation (including random flipping and rotation), is added for each epoch. The detailed benchmark summary is shown in Supplemental table 3. All training experiments were done using the same dataset with 4-fold cross validation, and same loss function and batch size. The metrics shown in the table refer to the neurite class, except for accuracy, which shows an overall pixel prediction accuracy. Training and inference were done on a Nvidia V100 16GB GPU.
Synapse segmentation
Process overview
To segment synapses from 3D fluorescent image stacks, WormPsyQi uses a two-layer pixel classification model (Figure 2 – figure supplement 2B). In the first layer, a set of predefined 2D and 3D local filters are applied to each pixel to generate a feature vector. The first-layer classifier then estimates the probability that a pixel belongs to a synapse based on this feature vector. In the second layer, the probability estimations of a pixel and its nearby pixels are added to the first layer’s feature vector to create an extended vector. This extended vector is then fed into the second-layer classifier to determine whether the pixel belongs to a synapse. Optionally, the binary neurite mask from the neuron segmentation step is used to filter out the false-positive pixels that are not in the vicinity of synapse-forming regions. Although we primarily used the Random Forest for the classifiers in this paper, WormPsyQi provides Random Forest (RF), Support Vector Machine (SVM), and multilayer perceptron as options for training a new model with the GUI. While SVM is effective in many different machine learning applications and generally less prone to overfitting with a small dataset, it is sensitive to noise and its fit time complexity is more than quadratic, making it less ideal for large training datasets. During training, grid search hyperparameter optimization with 5-fold cross-validation is used. For prediction, if the target image has a neurite mask segmented in the previous step, only the pixels in the mask are sampled to be predicted by the trained synapse segmentation model; otherwise, all pixels are subject to prediction. The local and probability features are extracted similarly to the training step, and pixels outside of the neurite mask are automatically classified as background.
Training data
One or more pairs of a fluorescent microscopy image and its corresponding binary label image are required to train the model (Figure 2). For the pre-trained models and strain-specific models used in this work, the pencil tool in Fiji (Schindelin et al., 2012) was used to generate binary label images.
Training of the first layer
The first-layer classifier is trained through two sequential training steps (Figure 2 – figure supplement 2B). In the first step, all positive pixels and a small portion of negative pixels near the positive ones are selected as a training set. Local features of these pixels are extracted and fed along with the label to train the first-layer classifier. Since only a small portion of negative pixels spatially close to the positive pixels is included in the initial training dataset, the first-layer classifier is particularly prone to type I error after this step. To resolve this issue, more negative pixels are added to the training dataset in the second step, and the classifier is retrained. After the first step, pixels in sampled patches are predicted by the trained classifier and false negative pixels are selected to be added to the training dataset. These target patches are sampled in a similar manner as before but are ten times larger in dimension. The first- layer classifier is then fitted again with this expanded training dataset.
Training of the second layer
As the size of a synapse is generally bigger than just a single pixel, a pixel adjacent to the positive foreground is more likely to be foreground than another pixel with the same local features but away from the foreground. To account for this factor, we added the probabilities of adjacent pixels being positive as additional features to the original local features for the second-layer classifier. For each pixel in the training dataset, probabilities of the target pixel and the six adjacent pixels (-1 and +1 in either x, y, or z direction) are calculated by the first-layer classifier and the feature vector is expanded with these six probability values. The second-layer classifier is then trained with the expanded features using the same model as the first-layer classifier (Figure 2 – figure supplement 2B).
Local features
The local features used in WormPsyQi’s synapse classifier include the pixel value, Sobel derivatives, difference of Gaussians (DoG), Laplacian of Gaussian (LoG), local average and standard deviation, and erosion of both synapse and neurite channels. Before training, each feature is normalized with a standard scaler, removing the mean and scaling to unit variance.
Patch sampling in training
Among the pixels in the label images, only a small portion of pixels in the patches surrounding positive labels is selected to be fed into the model as training data points (Figure 2 – figure supplement 2B). This step not only reduces the time and memory required for the training process but also results in higher accuracy by preventing the model from fitting to irrelevant data points. Each 2D slice in the original microscopy image is first divided into non-overlapping patches, and only the patches containing positive pixels in the corresponding patch in the label image are processed in the following steps. The size of the patches is set to twice the square root of the average area of the connected labels.
Pre-trained synapse segmentation models
WormPsyQi provides four different pre-trained synapse segmentation models: 1) labeled as “GRASP (sparse)” in the GUI, trained with three otIs612 (PHB>AVA GRASP) images, 2) “GRASP (dense)”, trained with three otIs653 (ASK>AIA GRASP) images, 3) “CLA-1”, trained with six otEx7503 (I5 CLA-1) images, and 4) “RAB-3”, trained with two otEx7231 (ASK RAB-3). Random Forest model was used for all of them.
Synapse distribution quantification
The relative locations of synaptic puncta along neurites were determined using synapse segmentation masks and neurite skeletons. The skeletons (Figure 10) were extracted on top of neurite segmentation masks generated by the pipeline, coupled with minor manual editing using NeuTube (Feng, Zhao, and Kim, 2015) in cases where the segmentation result was not perfect. For each synapse, its location was marked by the closest node of the skeleton with respect to its centroid coordinates. When a synapse was too large and unresolved, each pixel of the synapse was used instead of the centroid to give a smoother distribution. The distribution was normalized from 0 to 1 either by the entire neurite length (from soma to the axon terminal), or by synapse domain length (neurite segment occupied by synapses). The probability density of distribution of a population was acquired by combining all worms of the population and dividing the entire synaptic volume.
Code availability
The WormPsyQi software is implemented with Python and is publicly available at https://github.com/lu-lab/worm-psyqi. PyTorch (Paszke et al., 2019) is used for implementing the deep CNN model in synapse segmentation process, and Scikit-learn (Pedregosa et al., 2011) package is mainly used for other methods. A comprehensive guide to installing and operating the software is on the Github repository. To facilitate use, the code is accompanied by a user manual with instructions for synapse quantification that is both standardized to yield quantitative data and flexible for customization.
Acknowledgements
We thank Chi Chen for assistance with microinjections to generate strains; Ulkar Aghayeva for generating RAB-3 reporters for pharyngeal neurons MC, M3, and M4; Steven Cook, Emily Bayer, and Cyril Cros for kindly sharing previous image datasets for synapse analysis. This work was funded by an NSF NeuroNex award (#1707401) and NSF-Simons Southeast Center for Mathematics and Biology (#1764406).
Supplemental tables
Supplemental Table 1: List of fluorescent reporters analyzed in this paper using WormPsyQi. Strain identifier, genotype, datasets analyzed, and imaging conditions (stage, sex) are listed for each reporter.
Supplemental Table 2: Details of transgenic constructs and injections.
Supplemental Table 3: Segmentation benchmark for different U-Net structures.
Extended figure legends
References
- The pharynx of Caenorhabditis elegansPhilos Trans R Soc Lond B Biol Sci 275:299–325https://doi.org/10.1098/rstb.1976.0085
- WormAtlas Hermaphrodite Handbook - Nervous System - General DescriptionWormAtlas https://doi.org/10.3908/wormatlas.1.18
- Anatomical distribution and functional roles of electrical synapses in DrosophilaCurr Biol 32:2022–2036https://doi.org/10.1016/j.cub.2022.03.040
- Exploring the retinal connectomeMol Vis 17:355–379
- Mutually exclusive dendritic arbors in C. elegans neurons share a common architecture and convergent molecular cuesPLoS Genet 16https://doi.org/10.1371/journal.pgen.1009029
- C. elegans feedingWormBook :1–23https://doi.org/10.1895/wormbook.1.150.1
- Developmental genetics of the C. elegans pharyngeal neurons NSML and NSMRBMC Dev Biol 8https://doi.org/10.1186/1471-213X-8-38
- Past experience shapes sexually dimorphic neuronal wiring through monoaminergic signalingNature 561:117–121https://doi.org/10.1038/s41586-018-0452-0
- Ubiquitin-dependent regulation of a conserved DMRT protein controls sexually dimorphic synaptic connectivity and behavioreLife 9https://doi.org/10.7554/eLife.59614
- The Prop1-like homeobox gene unc-42 specifies the identity of synaptically connected neuronseLife 10https://doi.org/10.7554/eLife.64903
- The Lovász-Softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networksarXiv https://doi.org/10.48550/arxiv.1705.08790
- Plasticity of the electrical connectome of c. elegansCell 176:1174–1189https://doi.org/10.1016/j.cell.2018.12.024
- The diverse functional roles and regulation of neuronal gap junctions in the retinaNat Rev Neurosci 10:495–506https://doi.org/10.1038/nrn2636
- Classification of human enteric neuronsHistochem Cell Biol 156:95–108https://doi.org/10.1007/s00418-021-02002-y
- A multi-scale brain map derived from whole-brain volumetric reconstructionsNature 591:105–110https://doi.org/10.1038/s41586-021-03284-x
- Sleep is required to consolidate odor memory and remodel olfactory synapsesCell 186:2911–2928https://doi.org/10.1016/j.cell.2023.05.006
- An innexin- dependent cell network establishes left-right neuronal asymmetry in C. elegansCell 129:787–799https://doi.org/10.1016/j.cell.2007.02.052
- The connectome of the Caenorhabditis elegans pharynxJ Comp Neurol 528:2767–2784https://doi.org/10.1002/cne.24932
- Whole- animal connectomes of both Caenorhabditis elegans sexesNature 571:63–71https://doi.org/10.1038/s41586-019-1352-7
- Neuronal contact predicts connectivity in the C. elegans brainCurr Biol 33:2315–2320https://doi.org/10.1016/j.cub.2023.04.071
- Anatomy and physiology of the enteric nervous systemGut 47https://doi.org/10.1136/gut.47.suppl_4.iv15
- Development of connectivity in a motoneuronal network in Drosophila larvaeCurr Biol 25:568–576https://doi.org/10.1016/j.cub.2014.12.056
- Autonomous screening of C. elegans identifies genes implicated in synaptogenesisNat Methods 9:977–980https://doi.org/10.1038/nmeth.2141
- Caenorhabditis elegans sine oculis/SIX-type homeobox genes act as homeotic switches to define neuronal subtype identitiesProc Natl Acad Sci USA 119https://doi.org/10.1073/pnas.2206817119
- Directional Trans-Synaptic Labeling of Specific Neuronal Connections in Live AnimalsGenetics 200:697–705https://doi.org/10.1534/genetics.115.177006
- Structural and functional changes in the olfactory pathway of adult Drosophila take place at a critical ageJ Neurobiol 56:13–23https://doi.org/10.1002/neu.10215
- Factors regulating the abundance and localization of synaptobrevin in the plasma membraneProc Natl Acad Sci USA 103:11399–11404https://doi.org/10.1073/pnas.0600784103
- Neural Circuits of Sexual Behavior in Caenorhabditis elegansAnnu Rev Neurosci 41:349–369https://doi.org/10.1146/annurev-neuro-070815-014056
- Methods for analyzing neuronal structure and activity in Caenorhabditis elegansGenetics 218https://doi.org/10.1093/genetics/iyab072
- Efficient CRISPR/Cas9 mediated large insertions using long single-stranded oligonucleotide donors in C. elegansFEBS J https://doi.org/10.1111/febs.16876
- Expression of connexin36 in cone pedicles and OFF-cone bipolar cells of the mouse retinaJ Neurosci 24:3325–3334https://doi.org/10.1523/JNEUROSCI.5598-03.2004
- GFP Reconstitution Across Synaptic Partners (GRASP) defines cell contacts and synapses in living nervous systemsNeuron 57:353–363https://doi.org/10.1016/j.neuron.2007.11.030
- neuTube 1.0: A New Design for Efficient Neuron Reconstruction Software Based on the SWC FormateNeuro 2https://doi.org/10.1523/ENEURO.0049-14.2014
- Bright split red fluorescent proteins for the visualization of endogenous proteins and synapsesCommun Biol 2https://doi.org/10.1038/s42003-019-0589-x
- Improved split fluorescent proteins for the visualization of endogenous proteins and synapsesBiophys J 118https://doi.org/10.1016/j.bpj.2019.11.1072
- The enteric nervous system. Malden, MassachusettsUSA: Blackwell Publishing https://doi.org/10.1002/9780470988756
- Conserved neural circuit structure across Drosophila larval development revealed by comparative connectomicseLife 6https://doi.org/10.7554/eLife.29089
- 5’-Modifications improve potency and efficacy of DNA donors for precision genome editingeLife 10https://doi.org/10.7554/eLife.72216
- Melting dsDNA Donor Molecules Greatly Improves Precision Genome Editing in Caenorhabditis elegansGenetics 216:643–650https://doi.org/10.1534/genetics.120.303564
- Gap junctionsCold Spring Harb Perspect Biol 1https://doi.org/10.1101/cshperspect.a002576
- Molecular mechanisms of sexually dimorphic nervous system patterning in flies and wormsAnnu Rev Cell Dev Biol 37:519–547https://doi.org/10.1146/annurev-cellbio-120319-115237
- Stem cell niche exit in C. elegans via orientation and segregation of daughter cells by a cryptic cell outside the nicheeLife 9https://doi.org/10.7554/eLife.56383
- UNet-2022: Exploring Dynamics in Non- isomorphic ArchitecturearXiv https://doi.org/10.48550/arxiv.2210.15566
- Revealing architectural order with quantitative label-free imaging and deep learningeLife 9https://doi.org/10.7554/eLife.55502
- Gap junctions in C. elegans: Their roles in behavior and developmentDev Neurobiol 77:587–596https://doi.org/10.1002/dneu.22408
- The posterior nervous system of the nematode Caenorhabditis elegans: serial reconstruction of identified neurons and complete pattern of synaptic interactionsJ Neurosci 11:1–22https://doi.org/10.1523/JNEUROSCI.11-01-00001.1991
- Neurexin controls plasticity of a mature, sexually dimorphic neuronNature 553:165–170https://doi.org/10.1038/nature25192
- Channel- independent function of UNC-9/Innexin in spatial arrangement of GABAergic synapses in C. eleganseLife 11https://doi.org/10.7554/eLife.80555
- Spatiotemporal control of a novel synaptic organizer moleculeNature 523:83–87https://doi.org/10.1038/nature14545
- Glycolytic Enzymes Localize to Synapses under Energy Stress to Support Synaptic FunctionNeuron 90:278–291https://doi.org/10.1016/j.neuron.2016.03.011
- The connectome of a decision-making neural networkScience 337:437–444https://doi.org/10.1126/science.1221762
- SynaptogenesisWormBook :1–11https://doi.org/10.1895/wormbook.1.44.1
- Defective recycling of synaptic vesicles in synaptotagmin mutants of Caenorhabditis elegansNature 378:196–199https://doi.org/10.1038/378196a0
- An imbalancing act: gap junctions reduce the backward motor circuit activity to bias C. elegans for forward locomotionNeuron 72:572–586https://doi.org/10.1016/j.neuron.2011.09.005
- γ-Neurexin and Frizzled Mediate Parallel Synapse Assembly Pathways Antagonized by Receptor EndocytosisNeuron 100:150–166https://doi.org/10.1016/j.neuron.2018.09.007
- Synaptogenic pathwaysCurr Opin Neurobiol 57:156–162https://doi.org/10.1016/j.conb.2019.03.005
- The immunocytochemical localization of connexin 36 at rod and cone gap junctions in the guinea pig retinaEur J Neurosci 18:2925–2934
- Robust regulatory architecture of pan-neuronal gene expressionCurr Biol 32:1715–1727https://doi.org/10.1016/j.cub.2022.02.040
- Rapid Assembly of Presynaptic Materials behind the Growth Cone in Dopaminergic Neurons Is Mediated by Precise Regulation of Axonal TransportCell Rep 24:2709–2722https://doi.org/10.1016/j.celrep.2018.07.096
- Regulation of synaptic transmission by RAB-3 and RAB-27 in Caenorhabditis elegansMol Biol Cell 17:2617–2625https://doi.org/10.1091/mbc.E05-12-1170
- The C. elegans pharynx: a model for organogenesisWormBook :1–26https://doi.org/10.1895/wormbook.1.129.1
- Regulation of neuronal axon specification by glia- neuron gap junctions in C. eleganseLife 5https://doi.org/10.7554/eLife.19510
- Development and migration of the C. elegans Q neuroblasts and their descendantsWormBook :1–23https://doi.org/10.1895/wormbook.1.173.1
- Synaptogenesis: unmasking molecular mechanisms using Caenorhabditis elegansGenetics 223https://doi.org/10.1093/genetics/iyac176
- Structural and developmental principles of neuropil assembly in C. elegansNature 591:99–104https://doi.org/10.1038/s41586-020-03169-5
- Visualization of synaptic specializations in live C. elegans with synaptic vesicle protein-GFP fusionsJ Neurosci Methods 89:33–40https://doi.org/10.1016/s0165-0270(99)00031-x
- Caenorhabditis elegans rab-3 mutant synapses exhibit impaired function and are partially depleted of vesiclesJ Neurosci 17:8061–8073https://doi.org/10.1523/JNEUROSCI.17-21-08061.1997
- Sex-specific pruning of neuronal synapses in Caenorhabditis elegansNature 533:206–211https://doi.org/10.1038/nature17977
- The fusogen EFF-1 controls sculpting of mechanosensory dendritesScience 328:1285–1288https://doi.org/10.1126/science.1189095
- A lineage-resolved molecular atlas of C. elegans embryogenesis at single-cell resolutionScience 365https://doi.org/10.1126/science.aax1971
- PyTorch: An Imperative Style, High-Performance Deep Learning LibraryarXiv https://doi.org/10.48550/arxiv.1912.01703
- Reprogramming the topology of the nociceptive circuit in C. elegans reshapes sexual behaviorCurr Biol 32:4372–4385https://doi.org/10.1016/j.cub.2022.08.038
- Scikit-learn: Machine Learning in PythonarXiv https://doi.org/10.48550/arxiv.1201.0490
- C.Lelegans Punctin specifies cholinergic versus GABAergic identity of postsynaptic domainsNature 511:466–470https://doi.org/10.1038/nature13313
- LIN-10 is a shared component of the polarized protein localization pathways in neurons and epitheliaCell 94:751–759https://doi.org/10.1016/s0092-8674(00)81734-1
- U-Net: Convolutional Networks for Biomedical Image SegmentationarXiv https://doi.org/10.48550/arxiv.1505.04597
- Synaptic Protein Degradation Controls Sexually Dimorphic Circuits through Regulation of DCC/UNC-40Curr Biol 30:4128–4141https://doi.org/10.1016/j.cub.2020.08.002
- Deep phenotyping unveils hidden traits and genetic relations in subtle mutantsNat Commun 7https://doi.org/10.1038/ncomms12990
- Fiji: an open-source platform for biological-image analysisNat Methods 9:676–682https://doi.org/10.1038/nmeth.2019
- Differential adhesion regulates neurite placement via a retrograde zippering mechanismeLife 10https://doi.org/10.7554/eLife.71171
- The immunoglobulin superfamily protein SYG-1 determines the location of specific synapses in C. elegansCell 112:619–630https://doi.org/10.1016/s0092-8674(03)00113-2
- Organ Length Control by an ADAMTS Extracellular Protease in Caenorhabditis elegansG3 (Bethesda) 6:1449–1457https://doi.org/10.1534/g3.116.028019
- Electrical synapses interconnecting axons revealed in the optic nerve head - a novel model of gap junctions’ involvement in optic nerve functionActa Ophthalmol 98:408–417https://doi.org/10.1111/aos.14272
- Time-lapse imaging and cell-specific expression profiling reveal dynamic branching and molecular determinants of a multi-dendritic nociceptor in C. elegansDev Biol 345:18–33https://doi.org/10.1016/j.ydbio.2010.05.502
- Motor neurons control locomotor circuit function retrogradely via gap junctionsNature 529:399–402https://doi.org/10.1038/nature16497
- Molecular topography of an entire nervous systemCell 184:4329–4347https://doi.org/10.1016/j.cell.2021.06.023
- C. elegans Punctin Clusters GABA(A) Receptors via Neuroligin Binding and UNC-40/DCC RecruitmentNeuron 86:1407–1419https://doi.org/10.1016/j.neuron.2015.05.013
- The enteric nervous system of the C. elegans pharynx is specified by the Sine oculis-like homeobox gene ceh-34eLife 11https://doi.org/10.7554/eLife.76003
- Sexually Dimorphic unc-6/Netrin Expression Controls Sex-Specific Maintenance of Synaptic ConnectivityCurr Biol 28:623–629https://doi.org/10.1016/j.cub.2018.01.002
- The structure of the nervous system of the nematode Caenorhabditis elegansPhilos Trans R Soc Lond B Biol Sci 314:1–340https://doi.org/10.1098/rstb.1986.0056
- The development of synapses in mouse and macaque primary sensory corticesBioRxiv https://doi.org/10.1101/2023.02.15.528564
- Connectomes across development reveal principles of brain maturationNature 596:257–261https://doi.org/10.1038/s41586-021-03778-8
- Clarinet (CLA-1), a novel active zone protein required for synaptic vesicle clustering and releaseeLife 6https://doi.org/10.7554/eLife.29276
- Caenorhabditis elegans innexins regulate active zone differentiationJ Neurosci 29:5207–5217https://doi.org/10.1523/JNEUROSCI.0637-09.2009
- Identification of genes involved in synaptogenesis using a fluorescent active zone marker in Caenorhabditis elegansJ Neurosci 25:3833–3841https://doi.org/10.1523/JNEUROSCI.4978-04.2005
- Mind of a dauer: Comparative connectomics reveals developmental plasticityBioRxiv https://doi.org/10.1101/2023.03.23.533915
- The liprin protein SYD-2 regulates the differentiation of presynaptic termini in C. elegansNature 401:371–375https://doi.org/10.1038/43886
- The HSPG syndecan is a core organizer of cholinergic synapsesJ Cell Biol 220https://doi.org/10.1083/jcb.202011144
Article and author information
Author information
Version history
- Sent for peer review:
- Preprint posted:
- Reviewed Preprint version 1:
- Reviewed Preprint version 2:
- Version of Record published:
- Version of Record updated:
Copyright
© 2023, Majeed et al.
This article is distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use and redistribution provided that the original author and source are credited.
Metrics
- views
- 1,765
- downloads
- 142
- citations
- 3
Views, downloads and citations are aggregated across all versions of this paper published by eLife.