Abstract
Data volumes collected in many scientific fields have long exceeded the capacity of human comprehension. This is especially true in biomedical research where multiple replicates and techniques are required to conduct reliable studies. Ever-increasing data rates from new instruments compound our dependence on statistics to make sense of the numbers. The currently available data analysis tools lack user-friendliness, various capabilities or ease of access. Problem-specific software or scripts freely available in supplementary materials or research lab websites are often highly specialized, no longer functional, or simply too hard to use. Commercial software limits access and reproducibility, and is often unable to follow quickly changing, cutting-edge research demands. Finally, as machine learning techniques penetrate data analysis pipelines of the natural sciences, we see the growing demand for user-friendly and flexible tools to fuse machine learning with spectroscopy datasets. In our opinion, open-source software with strong community engagement is the way forward. To counter these problems, we develop Quasar, an open-source and user-friendly software, as a solution to these challenges. Here, we present case studies to highlight some Quasar features analyzing infrared spectroscopy data using various machine learning techniques.
Keywords: open source, machine learning, visual programming, data exploration, data analysis
1. Introduction
Spectroscopy offers insight into the chemical and physical properties of materials. Modern equipment can collect data at rates that make direct interpretation impossible for humans. For example, a single Fourier-transform infrared spectroscopy (FTIR) imaging microscope slide scan can generate more than a terabyte of data [1]. Such data volumes are reasonable and necessary in fields such as biomedical research where sufficient replicates are required. As a result, data analysis has become the bottleneck of scientific progress in many fields.
We approach data processing in various ways. Scientists specializing in data analysis often prefer to code, while non-programmers use various open-source and commercial software. Each approach has shortcomings, such as the difficulty of using and modifying lab-specific scripts, adapting to command-line tools, or the cost and inflexibility of closed-source environments. The use of multiple measurement techniques, common in biomedical research, results in different output data formats. If each format requires specialized software, it may be difficult to interpret the combined data.
Experiments require some degree of interactivity. Instrument manufacturers usually implement practical basic processing and visualization tools for this reason. They are especially useful for multidimensional data as inspecting a projection along a few variables (images, volumes or movies) during an experiment to help fine-tune parameters boosts data quality. However, interactivity is also crucial for data exploration, analysis, and producing final visualizations.
Complex, large volumes of data produced by the types of experiments discussed above requires a statistical approach for real understanding. Baker et al. [2] described a protocol widely used for the investigation of biological materials with infrared spectroscopy that is generalizable to most experiments. They divide data analysis into preprocessing, which addresses common issues with spectral data acquisition, and the application of multivariate statistical methods, such as clustering or supervised prediction. Some multivariate techniques, such as PCA or k-means clustering, are quite commonly used in the natural sciences, but the recent machine learning and deep learning boom of the tech industry has also found its way to the natural sciences resulting in new approaches for data analysis [3,4,5,6]. Tools that allow the application of recent machine learning methods usually require strong programming skills and until very recently user-friendly software for such studies was lacking.
In view of these issues, we see the highest potential in extendable, well-designed, user-friendly open-source software and the communities built around developing them into robust, and widely functional packages. We develop Quasar [7,8,9] as a solution to these challenges and present here applications in biospectroscopy data analysis.
2. Methods
Quasar is based on Orange [10,11,12,13], a user-friendly, open-source tool for machine learning and data visualization. Orange provides an accessible and interactive environment that offers a high degree of functionality while remaining adaptable to specific needs [14]. Orange offers:
Visual programming: Orange does not impose a preset order of operations. Instead, it offers components—widgets—that either process, visualize or model inputs. Users can connect them as they see fit as long as they share connection types. This approach allows the creation of flexible workflows;
Immediate feedback: Orange follows the general principle that being able to observe the effects of actions, and adapt immediately, improves efficiency. The option to inspect the results at every step of the analysis helps users gain confidence in results and familiarity with the analysis procedures [14];
Interactive visualizations: Orange allows interaction with visualized elements, which can influence further analysis—for example, selecting a point on a scatter plot sends the associated data to the output. This principle empowers users to further explore interesting elements identified in the visualization;
Machine learning: Orange includes components for unsupervised and supervised modeling and their evaluation. Mainly, it wraps established machine learning libraries for Python, such as scikit-learn or XGBoost, into user-friendly GUI components. Methods in Orange include various clustering methods, t-SNE, random forests, support vector machines, gradient boosting, and neural networks;
Extendability and modularity: Orange is mainly written in Python, with computationally intensive parts in C [13]. It builds on Python data science libraries, such as NumPy, SciPy, Pandas, and scikit-learn. If predefined components do not suffice, the Python Script widget allows adding custom Python code into the workflow. Additionally, Orange provides a well-documented programming interface for adding new components and modules. More than a dozen specialized modules currently exist, including text processing, gene expression data analysis [15], image analytics [14], and time series analysis.
Quasar is a packaged distribution of Orange, extended with specific, preselected add-ons, that we provide as a single installer. Currently, it extends Orange with components specific to spectral data analysis. The spectroscopy add-on, Orange Spectroscopy, evolved from the Infrared Orange add-on [16] and shares the same basic features with a plethora of improvements and new functionality. Compared to Infrared Orange, Orange Spectroscopy adds new spectral preprocessing methods along with many user interface and general stability improvements. Since our first report in 2017 [16], we added more than 30,000 lines of code into the orange-spectroscopy GitHub repository alone. Quasar’s new components for spectral data were designed for maximum interoperability with the rest of Orange. Therefore, all machine learning capabilities of Orange are available to the spectroscopist: techniques such as clustering or classification can be directly applied to spectral data. We achieve this by embracing Orange’s Table data structure and conforming to its ways of data processing.
To extend the data analytics capabilities provided by Orange, Quasar currently adds tools specialized for spectroscopy in several categories (Figure 1):
Data input: Quasar supports native data reading from major instrument manufacturers, commonly used exchange data formats and some specialized instruments;
Spectral preprocessing: Commonly used preprocessing methods for smoothing, derivatives, baseline removal, normalization, EMSC, ME-EMSC, integration, peak fitting, etc.;
Visualization: Plotting widgets for individual spectra, hyperspectral maps with visible image overlays, and maps of spectral series are available.
We develop Quasar as an open-source project available on GitHub under the GPL 3.0 license. Installation packages are available for major operating systems (Windows, macOS, and Linux).
3. Results and Discussion
This section highlights the capabilities and benefits of visual programming using Quasar through three case studies. Note that data and experiment types are not restricted to biospectroscopy; practically any type of data could be analyzed. The workflows we present include all crucial analysis steps recommended by Baker et al. [2].
3.1. Case Study 1: Identification and Localization of the Medullas in Human Hair Sections
To showcase unsupervised learning on spectral data with Quasar, we will use an FTIR hyperspectral dataset of multiple hair sections measured in transmission mode as described in detail in the study of Sandt and Borondics [17]. The dataset contains absorbance values in the 4000–800 cm−1 range. Figure 2 shows how Quasar allows identification of interesting groups of spectra: in this case, detecting the hair medulla. In the workflow, we used unsupervised learning—clustering—twice: first to remove physical variations such as the background or scattered edges, and then, to detect variations in the chemical composition inside the hair sections. Typically, we would use thresholds according to the intensity (the Select Rows widget in Quasar) to remove the background. On this dataset, k-Means clustering provided the separation we required.
To achieve a useful identification of groups of similar spectra, we clustered second derivatives of original spectra. Therefore, the output—spectral graph in the last HyperSpectra widget in the Figure 2c—is shown in the derivative space. Spectra in the derivative space are often harder to interpret. Thus, to investigate the selected spectrum of the medulla in the space of original data, we used a Spectra with the selected spectrum as its subset input; there, we were able to observe the selected spectrum before any processing. The spectrum reveals a characteristic lipid signature. Even though spectra in the dataset are saturated in the Amide I and II regions, the methods we employed were robust enough to identify a known biological structure, i.e., the medulla.
The case study showcases how immediate feedback influences the analysis. If we did not preprocess the data before the second k-Means clustering, the clusters obtained are not meaningful. On these data, seeing clustered display (in Hyperspectra) while searching for appropriate preprocessing proved invaluable: an interesting clustering result steered the analysis in a particular direction.
We used k-means clustering to find groups of similar spectra. Straightforward alternatives for grouping, such as hierarchical clustering or DBSCAN, would likely yield similar results, but k-means was computationally the most efficient. Furthermore, dimensionality reduction techniques such as principal component analysis, multidimensional scaling (MDS), or t-distributed stochastic neighbor embedding (t-SNE) applied before grouping could help better understand the structure within groups. Quasar offers all listed techniques.
One of the design principles of Quasar is that anything displayed can be analyzed further. In the workflow shown in Figure 3, we applied the principal component analysis (PCA) to clusters obtained in Figure 2. We needed to apply PCA to the original spectra, not the derivatives used for clustering, to understand the cluster’s spectral characteristics. We thus merged the resulting clusters with the original data and, after preprocessing, applied PCA. In Figure 3c, a Scatter Plot shows that the first principal component easily identifies the cluster, and the Spectra shows the corresponding loadings with the lipid signature.
3.2. Case Study 2: Building a Drug Resistance Prediction Model
Here, we apply supervised learning on FTIR spectra obtained from three different cell types, aiming to develop a statistical model for predicting resistance to all tyrosine kinase inhibitors (drugs aimed for treating chronic myeloid leukemia) conferred by the T315I mutation in the BCR-ABL gene [18]. The spectra in the dataset correspond to individual cells measured with synchrotron radiation FTIR microspectroscopy in transflection mode, each described by absorbance values in the 1800–900 cm−1 range. Figure 4 shows the workflow and its most important components. After preprocessing, we evaluated two supervised prediction methods, logistic regression and random forests, using five-fold cross-validation. Looking at the Test and Score widget, it is clear that random forests performed better for all calculated metrics.
Next, we closely investigated the prediction by random forests. The Confusion Matrix widget shows that random forests perfectly predicts the “Resistant” class, but sometimes mixes the “Wild-type” and “Bcr-abl” classes. Here, further analysis could show why these two classes are similar; if we selected mispredicted classes in the Confusion Matrix, they would be sent to the output, where we could analyze them further. To interpret the random forest model, we ranked wavenumbers according to their importance and displayed these ranks as Spectra. We can conclude that the region from 1600–1500 cm−1 is the most important for prediction. This region partially represents the protein spectral signatures. Interestingly, the wavenumber regions at the edges have high importance, which might be due an artifact.
Now that we have established the Quasar workflow, we could modify its settings and see the downstream effects. For example, changing preprocessing would influence the evaluation results, mispredictions, and the importance of features. Such exploratory modifications and observing their results can help gain valuable insight into the data.
Quasar implements current general-purpose supervised learning techniques, such as support vector machines, neural networks, and gradient boosting, which could have been used in this case study. Other modifications to the workflow, such as dimensionality reduction before model induction, could also benefit the analysis. Additionally, we could have inspected the obtained random forests further by looking into individual trees. The chosen models could also be saved and reused later to classify new measurements.
3.3. Case Study 3: Protein Secondary Structure Peak Fitting
Next, we highlight how peak fitting capabilities [19] are integrated into a larger workflow in Quasar using spectra from a study on human cirrhotic liver tissue [20] measured with FTIR and annotated according to the majority presence of a chemical compound (collagen, glycogen, lipids, or DNA) in that part of the cell. In a recent paper, Stani et al. [21] established a correlation between two distinct protein spectral regions (Amide I and Amide III) for collagen during thermal degradation. In their analysis, they use spectral preprocessing and peak fitting to extract secondary structure characteristics. Figure 5 shows the workflow which implements their described peak fitting method in Quasar.
After filtering the dataset to select rows labelled as “collagen”, we split the spectra into two sub-regions, Amide I (1750–1580 cm−1) and Amide III (1310–1175 cm−1), and identically preprocessed them with rubber band baseline correction and min-max normalization. We configured peak fitting, bands, components, and fitting constraints as described in [21], and obtained starting parameters from an initial fit performed on the average spectrum for the final full-dataset fit. The Peak Fit widget (Figure 5a; Amide III) shows the resulting fits for some example spectra, while fit result parameters, total fits, and residuals are output for the entire dataset.
Next, we can analyze the resulting fit parameters as any other feature in Quasar. Stani et al. [21] found a positive correlation between the Amide I 1690 cm−1 and the Amide III 1284 cm−1 components, assigning both to the carbonyls which comprise an intra-strand hydrogen bond network stabilizing the triple-helix fibrils. Despite the lack of perturbation in the dataset used here, we also observe a positive correlation between these component areas (Figure 5b) within the natural variation of the protein. We also find a correlation between the 1660 and 1240 cm−1 components, assigned to the well-known inter-strand hydrogen bonding in the triple-helix.
As the fit results are integrated into the Quasar workflow they can be further explored using approaches similar to the previous case studies.
3.4. Limitations and Further Development
Quasar, similarly to most general-purpose scientific software such as R, Matlab, or SciPy, requires the complete dataset in memory. Big data require specialized libraries that, instead of loading the entire dataset into memory, analyze the data while passing through it directly on a disk. The authors of the memory-efficient SIproc library [1] report that the rate of reading through the data is commonly their libraries’ speed-limiting factor. Still, their library only provides a programmatic interface excluding non-experts. Following the same philosophy, we are currently changing Orange and Quasar extensions to support out-of-memory data handling.
3.5. Current Project Reach
Currently, we know of 35 published scientific publications that successfully used Quasar or the Orange Spectroscopy add-on for data analysis (an up-to-date list is available at https://quasar.codes/publications/, accessed on 1 September 2021). Workshops about spectral data analysis with Quasar took place in Italy, Slovenia, Norway, France, Belarus, Canada, Australia, and, since COVID-19, online with participants from the UK, Sweden, Germany, and Egypt.
4. Conclusions
Here, we introduced Quasar, a software based on Orange, to reform data analysis in the natural sciences. Currently, Quasar provides tools and functionality aimed at spectroscopy data analysis and combines them with powerful machine learning methods. Thanks to the visual programming approach of Orange, scientists without any coding background can build flexible data processing workflows and explore various analysis ideas interactively. With the expansion of the Quasar community, and contributions from expert developers to the open-source code, functionality can be extended towards new fields, measurement and data analysis techniques. The free availability of Quasar addresses bottlenecks in adoption. In conclusion, we strongly believe that this approach will empower scientists to better and easier understanding of experimental data.
Acknowledgments
The development of Quasar is a real community effort from around the world and the authors of this paper gratefully acknowledge these contributions. We would like to extend our special thanks to the members of the Bioinformatics laboratory at the University of Ljubljana (Slovenia) for their continuous effort in improving Orange; Lisa Vaccari and Giovanni Birarda from the ELETTRA Synchrotron (Italy) for contributing to the Infrared Orange project in 2016; Scott M. Rosendahl from the Canadian Light Source (Canada) for dedicating resources to Infrared Orange and Quasar, Raul O. Freitas and João E. Levandoski from LNLS (Brazil) for developing s-SNOM related functionality; Achim Kohler, Johanne H. Solheim and Vladislav Blazsko from the NMBU University (Norway) for implementing the EMSC, ME-EMSC preprocessors and visual image overlays; Noah A. Cabanas from The University of North Carolina at Chapel Hill (USA, NC) who implemented Raman preprocessors and Peak Picking; Olga Roudenko from the SOLEIL Synchrotron (France) for implementing XAS/NEXAFS preprocessing. For a complete list of code contributors, please see the list on the GitHub page of the project [8].
Author Contributions
Software development: M.T., S.T.R. and F.B.; data acquisition and analysis: C.S., M.T., S.T.R. and F.B.; conceptualization: M.T. and F.B.; funding: F.B. All authors have read and agreed to the published version of the manuscript.
Funding
The Quasar project received funding from in-house grants from the ELETTRA Synchrotron (Italy), SOLEIL Synchrotron (France), and a bilateral travel grant from ARRS (Slovenia) and Campus France (France): PHC PROTEUS Project #37490NM. This work was supported by Slovenian Research Agency (P2-0209). The Canadian Light Source (Canada), a national research facility of the University of Saskatchewan, is supported by the Canada Foundation for Innovation (CFI), the Natural Sciences and Engineering Research Council (NSERC), the National Research Council (NRC), the Canadian Institutes of Health Research (CIHR), the Government of Saskatchewan, and the University of Saskatchewan.
Data Availability Statement
All data presented in the case studies are freely available from the Datasets widget in Quasar. To replicate, modify and explore our case studies, the workflow files can be found in a GitHub repository: https://github.com/Quasars/supp-cells-2021, accessed on 1 September 2021.
Conflicts of Interest
The authors declare no conflict of interest.
Footnotes
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Berisha S., Chang S., Saki S., Daeinejad D., He Z., Mankar R., Mayerich D. SIproc: An open-source biomedical data processing platform for large hyperspectral images. Analyst. 2017;142:1350–1357. doi: 10.1039/C6AN02082H. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Baker M.J., Trevisan J., Bassan P., Bhargava R., Butler H.J., Dorling K.M., Fielden P.R., Fogarty S.W., Fullwood N.J., Heys K.A., et al. Using Fourier transform IR spectroscopy to analyze biological materials. Nat. Protoc. 2014;9:1771–1791. doi: 10.1038/nprot.2014.110. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Berisha S., Lotfollahi M., Jahanipour J., Gurcan I., Walsh M., Bhargava R., Van Nguyen H., Mayerich D. Deep learning for FTIR histology: Leveraging spatial and spectral features with convolutional neural networks. Analyst. 2019;144:1642–1653. doi: 10.1039/C8AN01495G. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Magnussen E.A., Solheim J.H., Blazhko U., Tafintseva V., Tøndel K., Liland K.H., Dzurendova S., Shapaval V., Sandt C., Borondics F., et al. Deep convolutional neural network recovers pure absorbance spectra from highly scatter-distorted spectra of cells. J. Biophotonics. 2020;13:e202000204. doi: 10.1002/jbio.202000204. [DOI] [PubMed] [Google Scholar]
- 5.Chen H., Chen A., Xu L., Xie H., Qiao H., Lin Q., Cai K. A deep learning CNN architecture applied in smart near-infrared analysis of water pollution for agricultural irrigation resources. Agric. Water Manag. 2020;240:106303. doi: 10.1016/j.agwat.2020.106303. [DOI] [Google Scholar]
- 6.Falahkheirkhah K., Yeh K., Mittal S., Pfister L., Bhargava R. Deep learning-based protocols to enhance infrared imaging systems. Chemom. Intellig. Lab. Syst. 2021;217:104390. doi: 10.1016/j.chemolab.2021.104390. [DOI] [Google Scholar]
- 7.Quasar Website. [(accessed on 1 September 2021)]. Available online: https://quasar.codes.
- 8.The GitHub Project Page for Orange Spectroscopy. [(accessed on 1 September 2021)]. Available online: https://github.com/Quasars/orange-spectroscopy.
- 9.Toplak M., Read S., Borondics F. Quasar. Zenodo. 2021 doi: 10.5281/zenodo.5137807. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Orange Website. [(accessed on 1 September 2021)]. Available online: https://orangedatamining.com/
- 11.The Github Project Page for Orange. [(accessed on 1 September 2021)]. Available online: https://github.com/biolab/orange3.
- 12.Curk T., Demsar J., Xu Q., Leban G., Petrovic U., Bratko I., Shaulsky G., Zupan B. Microarray data mining with visual programming. Bioinformatics. 2005;21:396–398. doi: 10.1093/bioinformatics/bth474. [DOI] [PubMed] [Google Scholar]
- 13.Demšar J., Curk T., Erjavec A., Gorup Č., Hočevar T., Milutinovič M., Možina M., Marko Toplak M.P., Starič A., Štajdohar M., et al. Orange: Data Mining Toolbox in Python. J. Mach. Learn. Res. 2013;14:2349–2353. [Google Scholar]
- 14.Godec P., Pančur M., Ilenič N., Čopar A., Stražar M., Erjavec A., Pretnar A., Demšar J., Starič A., Toplak M., et al. Democratized image analytics by visual programming through integration of deep models and small-scale machine learning. Nat. Commun. 2019;10:1–7. doi: 10.1038/s41467-019-12397-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15.Stražar M., Žagar L., Kokošar J., Tanko V., Erjavec A., Poličar P.G., Starič A., Demšar J., Shaulsky G., Menon V., et al. scOrange—A tool for hands-on training of concepts from single-cell data analytics. Bioinformatics. 2019;35:i4–i12. doi: 10.1093/bioinformatics/btz348. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Toplak M., Birarda G., Read S., Sandt C., Rosendahl S., Vaccari L., Demšar J., Borondics F. Infrared orange: Connecting hyperspectral data with machine learning. Synchrotron Radiat. News. 2017;30:40–45. doi: 10.1080/08940886.2017.1338424. [DOI] [Google Scholar]
- 17.Sandt C., Borondics F. A new typology of human hair medullas based on lipid composition analysis by synchrotron FTIR microspectroscopy. Analyst. 2021;146:3942–3954. doi: 10.1039/D1AN00695A. [DOI] [PubMed] [Google Scholar]
- 18.Sandt C., Feraud O., Bonnet M.L., Desterke C., Khedhir R., Flamant S., Bailey C.G., Rasko J.E., Dumas P., Bennaceur-Griscelli A., et al. Direct and rapid identification of T315I-Mutated BCR-ABL expressing leukemic cells using infrared microspectroscopy. Biochem. Biophys. Res. Commun. 2018;503:1861–1867. doi: 10.1016/j.bbrc.2018.07.127. [DOI] [PubMed] [Google Scholar]
- 19.Newville M., Otten R., Nelson A., Ingargiola A., Stensitzki T., Allan D., Fox A., Carter F., Michał, Pustakhod D., et al. lmfit/lmfit-py 1.0.2. Zenodo. 2021 doi: 10.5281/zenodo.4516651. [DOI] [Google Scholar]
- 20.Le Naour F., Sandt C., Peng C., Trcera N., Chiappini F., Flank A.M., Guettier C., Dumas P. In situ chemical composition analysis of cirrhosis by combining synchrotron fourier transform infrared and synchrotron X-ray fluorescence microspectroscopies on the same tissue section. Anal. Chem. 2012;84:10260–10266. doi: 10.1021/ac302072t. [DOI] [PubMed] [Google Scholar]
- 21.Stani C., Vaccari L., Mitri E., Birarda G. FTIR investigation of the secondary structure of type I collagen: New insight into the amide III band. Spectrochim. Acta Part Mol. Biomol. Spectrosc. 2020;229:118006. doi: 10.1016/j.saa.2019.118006. [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
All data presented in the case studies are freely available from the Datasets widget in Quasar. To replicate, modify and explore our case studies, the workflow files can be found in a GitHub repository: https://github.com/Quasars/supp-cells-2021, accessed on 1 September 2021.