dataesr/scientific-paragraphs-categorization huggingface dataset:
These four components may be reused by many models. The AnnDataLoader was written as a generic class and already has support for jointly processing data from multiple modalities, such as transcriptomics and proteomics data in totalVI. The TrainingPlan subclasses cover a wide range of scenarios, from optimizing a simple objective function, such as in maximum likelihood estimation (MLE), expectation maximization (EM), or variational inference (VI), to more complex semi-supervised learning procedures as is done in scANVI for handling cells with unobserved annotations. Finally, the available Mixin(s), like the VAEMixin that offers procedures specific to the variational autoencoder (VAE) (listed in Supplementary Figure  4c ), can be inherited by new models and augment their functionalities. Consequently, methods developers can focus on the Module class, which specifies the parameters of the model, the metric of fitness (e.
It is composed of two distinct latent variables models. The first model is trained with an annotated scRNA-seq dataset and learns the gene expression profiles of every annotated cell type. The second model, trained on the spatial data, assumes that the counts in every spot come from a linear combination of the same cell types defined in the scRNA-seq data. The coefficients in this linear combination are normalized and returned as the inferred cell-type proportions at every spot. There are several reasons for including Stereoscope in scvi-tools. First, while it is a significant and timely contribution for leveraging spatial transcriptomics, it is difficult to use in practice. Indeed, the reference implementation only provides a command line interface to run the algorithm rather than an API, thus complicating its integration in analysis pipelines.
Second, Stereoscope is a linear model that is fit with maximum a posteriori inference. It is therefore conceptually different from many of the other models currently implemented in scvi-tools, most of which are deep generative models trained with amortized variational inference. Consequently, this example illustrates the flexibility of our developer interface. A third reason is the elegance and conciseness of this model, which made it a good case study for demonstrating an implementation with our PyTorch backend. Using the scvi-tools developer interface provided both a conceptual and practical simplification of the reimplementation, focusing most of the effort on the formulation of the actual probabilistic model. Specifically, our implementation consisted of two module classes and two model classes (one pair of classes per latent variable model; Figure  5b ).
It was not necessary to write any code for data loading or training, as these functionalities are inherited through the scvi-tools base classes. Consequently, we observed a marked reduction both in the code complexity (average cyclomatic complexity  [77] ) and the number of lines of code (Methods) compared to the original codebase (Figure  5c ). To further illustrate the simplicity of implementing new models in scvi-tools, we elaborate on the development of the ScSignatureModule class (the module class for the scRNA-seq data latent variable model). In the model, for every cell n, the observed data includes its cell type c n , its library size l n and for every gene g, the gene expression x ng. Let G be the number of observed genes and let C be the number of annotated cell types. The parameters of the model, which we want to infer, specify the distribution of each gene g in every cell type c.
In contrast to VAEs (Figure  4b ), there is no need to provide an implementation of the inference method because there are no latent variables. Our implementation therefore consists only of the generative function and the loss. We applied the method to the 10x Visium spatial transcriptomics data of an adult mouse brain [78] and a single-cell RNA sequencing dataset of the mouse hippocampus  [79]  (Methods). A schematic of the user experience in Figure  5f. Applying Stereoscope and visualizing the results with Scanpy takes less than 20 lines of code including the import statements and the call to the Scanpy library. In contrast to the original software, which only accommodated a command line interface, our reimplementation can be used from Jupyter notebooks and with AnnData objects. The result of our Stereoscope implementation, which appears in Figure  5g , performs nearly the same as the original implementation (Supplementary Figure  5 ) in terms of the average Spearman correlation of cell-type proportion across all individual cell types.
Discussion We have developed scvi-tools, a resource for the probabilistic analysis of single-cell omics data with standardized access to more than ten models that can collectively perform a multitude of tasks across several omics. We also equipped several models with new features to aid in the analysis of large, complex data collections via the implementations of removal of unwanted variation due to arbitrary covariates and reference-query integration with scArches. To simplify the usage of scvi-tools, we made the functionalities of models concentrated in scope and ensured seamless connection with the single-cell software ecosystem at large. Thus, preprocessing and downstream analysis (e. g. , clustering of a latent space) can be performed with widely-used packages like Scanpy and Seurat. On the scvi-tools documentation website, we feature the API reference of each model as well as tutorials describing the functionality of each model and its interaction with other single-cell tools.
We also made these tutorials available via Google Colab, which provides a free compute environment and GPU and can even support large-scale analyses. At its core, scvi-tools is based on reusable software building blocks for constructing single-cellfocused probabilistic models. With these building blocks, we reimplemented our own previously described models and external models, which together span several inference techniques, like MAP inference, EM, and many stochastic variational inference algorithms  [80]  such as amortized variational inference  [81]. Further, standardized implementations of these models allowed us to add features to many models simultaneously, like in the case of scArches. We expect that this type of method development will grow in popularity following future advancements in microfluidics and molecular biology that will produce a new set of computational challenges.
scvi-tools models contain modules that structure the implementation of a generative process and inference procedure. While we focused on the developing modules directly with PyTorch, we can alternatively develop a module with Pyro. From a developer's perspective, it may be unclear when one should use the PyTorch backend or the Pyro backend for module development. Using Pyro comes with many benefits, such as automated ELBO computation and automatic differentiation variational inference  [74]. We envision that Pyro will be useful for hierarchical Bayesian models with a large collection of latent variables, such as cell2location  [82]. Pyro will be also appropriate in cases where a black-box inference procedure is known to work well. However, for more complex cases with inference schemes that deviate from standard Bayesian recipes (e.
, and ownership interest in Cellarity, Inc. parameter flavor="seurat_v3". For each of the following methods, we used the cell_source and donor fields of the dataset as categorical covariates. For continuous covariates, we generated 8 random covariates by sampling from a standard normal distribution in addition to treating the percent_mito and percent_ribo fields as additional continuous covariates, for a total of 10 continuous covariates. For scVI runtime, we tracked the runtime of running the train function with the following parameters: early_stopping=True, early_stopping_patience=45, max_epochs=10000, batch_size=1024, limit_train_batches=20, train_size=0. 9 if n_cells < 200000 and train_size=1-(20000/n_cells) otherwise This choice of the size parameter for the training set ensures that the validation set always has size of less than 20,000 cells for the whole runtime experiment.
Transfer learning with scArches The reference dataset of Human PBMCs corresponding to the CITE-seq dataset described in  [69]  was downloaded from Gene Expression Omnibus (Accession ID GSE164378). Associated metadata, like cell-type annotations, were retrieved from https://atlas. fredhutch. org/nygc/ multimodal-pbmc/. The query dataset of Human PBMCs corresponding to the CITE-seq dataset described in ref. [68]  was provided by the authors, with full metadata including study-derived annotations and other study design information. The reference data were additionally filtered to include cells that meet the following criteria: (1) greater than 150 proteins detected, (2) percent mitochondrial counts less than 12%, (3) not doublets (i. e. , reference cells annotated as doublets removed), (4) natural log protein library size, defined as total protein counts, between 7.
6 and 10. 3. Furthermore, protein features corresponding to isotype controls were removed (for reference and query), and protein features targeting the same protein (i. e. , antibody clones) were summed together (applies to reference only). The query data were additionally filtered for doublets using Scrublet  [87]  with default parameters. Highly variable genes (4000) were selected using only the reference datasets and with the method in Scanpy (flavor="seurat_v3"). Finally, the protein expression for a random set of five out of the 24 batch categories (representing time and donor) in the reference dataset were masked from totalVI, in order to help the model generalize to query data with mismatched proteins. In the case of scArches, totalVI was trained on the reference data for 250 epochs, using two hidden layers and layer normalization as described in the totalVI scArches tutorial https://docs.
scvi-tools. org/en/stable/user_guide/notebooks/scarches_scvi_tools. html. After applying the scArches architectural surgery, the model was updated with the query data for 150 additional epochs. The latent representation for the reference and query datasets was obtained from the model after it was updated with the query data; however, we note that the latent representation of the reference data does not change after query traning in the case of scArches. In the case of default totalVI, we kept all hyperparameters and data preprocessing the same, except that we trained totalVI only once, on the concatenated reference and query datasets for 250 epochs. For both scArches and default totalVI, we transferred the reference cell-type annotations using a random forest classifier implemented in scikit-learn  [88].
Evaluation We downloaded two datasets with full metadata and cell-type marker matrices from the original publication  [39]  (from https://zenodo. org/record/3372746) and compared the scvi-tools implementation predictions to the original predictions for these datasets. The first dataset consisted of 9,156 cells from lymph node biopses of two follicular lymphoma (FL) patients. The second dataset consisted of 4,848 cells from a high-grade serous carcinoma (HGSC) patient. On both datasets, the scvi-tools implementation predictions were highly reproducible with the original implementation (Supplementary Figure  6a-f ). UMAP embeddings used in Supplementary Figure  6  were the original embeddings from the publication and were retrieved from the downloaded objects. Next, we evaluated the runtime of the two implementations on a desktop with an Intel Core i9-10900K 3.
7 GHz processor, 2x CorsairVengeance LPX 64GB ram, and an NVIDIA RTX 3090 GPU. To do so, we used a dataset of 68k peripheral blood mononuclear cells from 10x Genomics [78], and used the same cell-type marker matrix as the FL dataset (23 markers, 5 cell types). Across a range of cells, we observed that the scvi-tools implementation is consistently faster and thus more scalable (Supplementary Figure  6g ). This is mostly due in part to the minibatching, which is a capability present in the original codebase, but not set as default (also no guidance on how to set it). Thus, we have shown that the scvi-tools implementation of CellAssign is both reproducible, and by default, more scalable than the original implementation.
Figure3: Sequential integration of CITE-seq PBMC samples with totalVI and the scArches method. a, Code-based overview of using scArches with the implementation of totalVI in scvi-tools. scArches was implemented globally through the ArchesMixin class. First, the reference model is trained on reference data, and then the scArches architectural surgery is performed when load_query_data is called on the query data. Finally, the (now) query model is trained with the query data and downstream analysis is performed. b, c, UMAP embedding of the totalVI reference and query latent spaces colored by (b) the reference labels and predicted query labels and (c) the dataset of origin. d, Row-normalized confusion matrix of scArches predicted query labels (rows) and study-derived cell annotations (columns).
Acknowledgements We acknowledge members of the  Streets and Yosef laboratories  for general feedback. We thank all the  GitHub users  who contributed code to scvi-tools over the years. We thank  Nicholas Everetts  for help with the analysis of the Drosophila data. We thank  David Kelley  and  Nick Bernstein  for help with implementing Solo. We thank  Marco Wagenstetter  and  Sergei Rybakov  for help with the transition of the scGen package to use scvi-tools as well as feedback on the scArches implementation. We thank  Hector Roux de Bézieux  for insightful discussions about the R ecosystem. We thank  Kieran Campbell  and  Allen Zhang  for clarifying aspects of the original CellAssign implementation. We thank the Pyro team, including  Eli Bingham ,  Martin Jankowiak , and  Fritz Obermeyer , for help with integrating Pyro in scvi-tools.
Research reported in this manuscript was supported by the  NIGMS of the National Institutes of Health  under award number  R35GM124916  and by the  Chan-Zuckerberg Foundation Network  under grant number  2019-02452. A. G. is supported by  NIH   Training Grant   5T32HG000047-19. A. S. and N. Y. are Chan Zuckerberg Biohub investigators.
Temporal bone CT-scan is a prerequisite in most surgical procedures concerning the ear such as cochlear implants. The 3D vision of inner ear structures is crucial for diagnostic and surgical preplanning purposes. Since clinical CT-scans are acquired at relatively low resolutions, improved performance can be achieved by registering patient-specific CT images to a high-resolution inner ear model built from accurate 3D segmentations based on micro-CT of human temporal bone specimens. This paper presents a framework based on convolutional neural network for human inner ear segmentation from micro-CT images which can be used to build such a model from an extensive database. The proposed approach employs an auto-context based cascaded 2D U-net architecture with 3D connected component refinement to segment the cochlear scalae, semicircular canals, and the vestibule.
The system was formulated on a data set composed of 17 micro-CT from public Hear-EU dataset. A Dice coefficient of 0. 90 and Hausdorff distance of 0. 74 mm were obtained. The system yielded precise and fast automatic inner-ear segmentations. Temporal bone CT-scan is largely used for diagnostic and surgical preplanning in diseases involving the inner ear such as hearing loss and balance disorders 1. In routine practice, this technique offers a series of 2D images which are browsed back and forth by the practitioner to mentally deduce 3D information and to this end 3D reconstructions have been applied to training and surgical planning 2. On independent 2D image slices, multiple structures can be confounded with inner ear and the mental reconstruction of inner ear structures can be difficult (Fig.
Material and methods Dataset preprocessing. The Hear-EU cochlear public dataset was chosen for this project  42. It consists of micro CT-scans from 17 human temporal bone specimens. The ground truth labels, manually delineated by an expert neuroradiologist on each slice, consisted of cochlear scalae, semicircular canals, and the vestibule. The images were acquired at 16. 3 μm for 13 specimens and 19. 5 μm voxel resolutions for the remaining 4. The original volume size of the CT-scans ranged from 618 × 892 × 600 to 1500 × 1500 × 1500. CT-scans were resampled to a fixed size of 256 × 256 × 256 voxels (using spline interpolation), corresponding to 4352 image slices in the dataset for computational and memory requirements. The ground truth labels were not aligned with the raw CT-scan images in 5 specimens and these data were manually aligned with the CT-scan data.
The output layer was a 1 × 1 convolutional layer with sigmoid activation function. Training. The network was trained using individual slices of the input volumes. The weights were updated using Adam optimizer with a learning rate of 0. 0001. The training was carried out with a batch size of 20 for maximum 200 epochs with early-stopping criteria in each stage, where the best model on training dataset (with the lowest training loss) was checkpointed and stored for testing. The training was carried out with a batch size of 20 for 200 epochs in each stage, where the best model was checkpointed and stored for testing. The binary cross entropy was used as the cost function. The first network was trained until convergence and its output was post-processed and fed into the second network as input for training and similarly for the last stage.
The model was implemented using Keras and TensorFlow libraries on a standard Intel i7 computer with 32 GB RAM and a dedicated GPU (Nvidia Titan X processor, 12 GB RAM) and validated using a fourfold cross validation approach with all slices belonging to a patient kept in the same fold. The fourfold evaluation, with hold-out test sets, was performed to reduce the influence of biases in the quantitative analysis  43. The dataset included in this study was obtained from two different scanners and acquisition protocols and was randomly placed into the different folds. During the evaluation, different combinations of the orthogonal axes were also tested to determine the optimum ordering of orientation. The code is available at https ://githu b. com/raabi d236/AutoC asNet. As comparison, the runtime of the framework was also tested on a standard Intel Xeon E5-2609 computer with 16 GB RAM.
Results All networks were trained from scratch until the training error reached a plateau state. The dropout regularization helped to prevent overfitting. Table  1  depicts the quantitative results of the segmentation. In general, AutoCasNet based networks outperformed their corresponding state of the art networks  48  in most of the evaluation metrics for all the patients in the dataset with AutoCasU-Net yielding the best segmentation. The largest improvement was seen in case of SEU-Net. Moreover, during the experiments similar results were obtained when the order of the slice orientations was changed, ensuring repeatability. Figure  4  depicts the qualitative segmentation results on different image slices. The Wilcoxon signed-rank test revealed a significant improvement in most test cases.
Discussion In this study, we presented a fully automatic neural network for segmenting inner ear structures from micro-CT images. The system yielded a precise 3D reconstruction in a few seconds on a computer equipped with a GPU. A PC without a GPU produced the result in less than 5 min. The precision and the rapidity of this program are compatible with its use in routine practice. Although the segmentation performance might increase with the integration of contextual information through 3D architectures or shape prior modelling as a post-processing step  49, 50  due to the limited size of the dataset and the large volume size, these options were excluded and a 2D architecture that processed each slice individually was adopted instead. Although patch-based 3D approaches can reduce the high-memory requirements, such approaches are still computationally expensive and they do not incorporate global context which may lead to incomplete segmentations.
Another advantage of using slices instead of whole volumes was to extend the dataset size to 4352 individual and independent input cases. The disadvantage of a 2D architecture was that slices do not include all the geometric information of the inner ear and targets can be more easily confounded with similar regions (Fig. 1 ). To overcome this weakness, a three-stage cascaded convolutional neural network design was adopted to incorporate 3D information. It employed a 2D U-Net architecture followed by 3D largest-region extraction at each stage in an auto-context framework. We compared the performance of the proposed framework with other deep-learning architectures, and despite the limited size of the dataset, the architecture outperformed other state-of-the-art segmentation algorithms according to several conventional metrics.
ResU-Net, and SEU-Net are generally considered to be improved modifications of the original U-Net  51, 52  , but even with the optimal network Table  1. Quantitative inner ear segmentation results based on Dice coefficient (Dcc), Jaccard index (JI), accuracy (Acc), precision (Pre), recall (Rec), specificity (Spe), area under ROC curve (AUC) and Hausdorff distance (HD). The results for the baseline networks are for axial viewpoints (0. 2-1. 1% better average dice coefficient performances obtained from this view compared to coronal or sagittal orientations; data not shown). The best metrics for each comparison are shown in bold. The results are an average of the 17 3D μCT volumes. * p < 0. 05, Wilcoxon signed-rank test. parameters (e. g. number of layers, filter size, learning rate), they could not compete with U-Net.
This advantage was also observed for AutoCasNet frameworks with the same parameters. This difference may be explained by the complex nature of inner ear anatomy and the common choice of hyperparameters in all the frameworks. Indeed, systematic comparisons of U-Net performance in the field of virus identification has shown that a judicious choice of hyperparameters for each framework are pivotal especially if a limited number of trainable weights are used  53. The runtime was adequate for clinical use and could be further improved with a C + + implementation (instead of Python which is comparatively a higher-level language)  54. The relative high standard deviation for some metrics could be due to the fact that temporal bones contain air cells that resemble inner ear cavities on Although deep-learning-based methods were used in the AutoCasNet framework in this project, conventional 2D segmentation algorithms could replace them as the basic segmentation technique in this framework.
Reduced Genetic Diversity with an Excess of Common Deleterious Variants We sequenced 89 new high-coverage whole exome sequences (WES) from Iberian Roma and merged them with previously published European and South Asian WES  (Auton et al. 2015; Tomb acz et al. 2017 ) that were used as ancestry sources of the Roma. We also genotyped a single-nucleotide polymorphism (SNP) array in a subset of 62 Iberian Roma. After quality control filters, the WES data set contains 410,225 variants in 527 samples, and the array data set 474,632 variants in 487 samples (see supplementary note 1, Supplementary Material online, supplementary figs. 1-6, Supplementary Material online, and supplementary table 1, Supplementary Material online for further details). We also merged both data sets to increase the number of covered genome-wide variants  (878, 162 SNPs).