Web-based intelligent analysis system and method for single-cell RNA sequencing data
By employing a web-based intelligent analysis system for single-cell RNA sequencing data, and utilizing multi-threshold screening and intelligent tag anti-overlap algorithms, the system addresses the issues of complex operation, low efficiency, and unstable results in existing technologies, achieving efficient and stable single-cell RNA sequencing data analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WOMEN & CHILDRENS MEDICAL CENTER AFFILIATED WITH GUANGZHOU MEDICAL UNIVERSITY
- Filing Date
- 2026-04-01
- Publication Date
- 2026-07-07
AI Technical Summary
Existing single-cell RNA sequencing data analysis tools have high operational barriers, low batch analysis efficiency, unstable results, and poor interactivity, and are prone to errors, especially when analyzing multi-species data.
This paper presents a web-based intelligent analysis system for single-cell RNA sequencing data, including a user interaction module, an intelligent anomaly analysis module, an offline enrichment analysis module, and a visualization output module. Through multi-threshold screening algorithms, automatic species identification, and intelligent label anti-overlap algorithms, it achieves efficient and stable analysis without programming.
It significantly lowers the operational threshold, improves analytical efficiency and the stability and reliability of results, supports interactive exploration, and enhances the readability of charts and biological reliability.
Smart Images

Figure CN122050537B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bioinformatics, and in particular to a Web-based intelligent analysis system and method for single-cell RNA sequencing data. Background Technology
[0002] Single-cell RNA (ribonucleic acid) sequencing technology has become an important tool in life science research. Currently, the analysis of this type of data mainly relies on the following methods:
[0003] (1) Programming software packages, such as Seurat in the R language environment or Scanpy in the Python language environment. Users need to write code scripts to call functions for data analysis, visualization and result export. This solution requires users to have corresponding programming skills, has a high threshold for operation, and has low batch processing efficiency and cumbersome parameter adjustment;
[0004] (2) Existing Web tools, such as cellxgene or Loupe Browser. These tools usually only provide data visualization browsing functions and lack in-depth statistical analysis (such as differential expression analysis, enrichment analysis) and batch processing capabilities.
[0005] Furthermore, existing enrichment analysis tools largely rely on online databases and network APIs (Application Programming Interfaces), making them susceptible to network instability and prone to non-reproducible results due to database updates. Additionally, in multi-species data analysis, users need to manually switch databases, which can easily lead to errors due to accidental operations.
[0006] Therefore, there is an urgent need in this field for a single-cell data analysis solution that can lower the barrier to entry, improve analysis efficiency, ensure stable and reliable results, and support interactive exploration. Summary of the Invention
[0007] In view of this, the purpose of this invention is to provide a Web-based intelligent analysis system and method for single-cell RNA sequencing data, which solves the problems of high operation threshold, low batch analysis efficiency, unstable results and poor interactivity in the prior art, and provides biomedical researchers with a one-stop analysis platform that is efficient, stable and reproducible without programming.
[0008] In a first aspect, the present invention provides a Web-based intelligent analysis system for single-cell RNA sequencing data, comprising:
[0009] The user interaction module is used to receive cell groups via a web interface, the cell groups including at least two single-cell RNA sequencing data to be compared;
[0010] The intelligent anomaly analysis module is used to perform differential gene analysis on single-cell RNA sequencing data contained in cell groups to obtain an original list of differentially expressed genes. A multi-threshold screening algorithm is used to filter the original list of differentially expressed genes to obtain a target list of differentially expressed genes. The multi-threshold screening algorithm includes at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold.
[0011] The offline enrichment analysis module is used to automatically identify species in the target differential gene list, call the target local gene set database based on the results of the automatic species identification, and perform parallel enrichment analysis on the target differential gene list without relying on network connection based on the target local gene set database to obtain gene enrichment analysis results.
[0012] The visualization output module is used to generate an interactive chart corresponding to the target differential gene list and / or gene enrichment analysis results using an intelligent label anti-overlap algorithm, so as to visualize the interactive chart.
[0013] In one implementation, a multi-threshold filtering algorithm is used to filter the original differentially expressed gene list to obtain a target differentially expressed gene list, including:
[0014] Determine the statistical significance, fold change in expression, and difference in expression ratio for each gene in the original differentially expressed gene list;
[0015] Determine whether the statistical significance is less than the statistical significance threshold, whether the change in expression fold is greater than the change in expression fold threshold, and whether the difference in expression ratio is greater than the difference in expression ratio threshold.
[0016] If any judgment result is negative, the gene is removed from the original differential gene list to obtain the target differential gene list.
[0017] In one implementation, the target differential gene list is subjected to automatic species identification processing, including:
[0018] Extract the name features of the target differential gene list, and make a preliminary determination of the species to which the target differential gene list belongs based on the name features and the preset gene naming rules;
[0019] If the initial determination fails, the target differential gene list is matched with a pre-stored multi-species characteristic gene library to determine the species to which the target differential gene list belongs based on the gene matching results.
[0020] In one implementation, a network-connection-independent parallel enrichment analysis is performed on a target differentially expressed gene list based on a target local gene set database to obtain gene enrichment analysis results, including:
[0021] Based on the fold change in expression of each gene in the target differentially expressed gene list, the target differentially expressed gene list is divided into a first upregulated gene set and a first downregulated gene set;
[0022] Based on the target local gene set database, offline parallel enrichment processing is performed on the first upregulated gene set and / or the first downregulated gene set to obtain the enrichment analysis results of upregulated genes and / or the enrichment analysis results of downregulated genes.
[0023] In one implementation, an intelligent tagging anti-overlap algorithm is used to generate a list of target differentially expressed genes and / or an interactive chart corresponding to the gene enrichment analysis results, including:
[0024] For the target differentially expressed gene list, perform the following operations: Based on the fold change in expression of each gene in the target differentially expressed gene list, divide the list into a second upregulated gene set and a second downregulated gene set; sort the genes in the second upregulated gene set in descending order according to the difference in expression ratio, and extract the second upregulated gene set to be displayed from the second upregulated gene set based on the descending order; sort the genes in the second downregulated gene set in ascending order according to the difference in expression ratio, and extract the second downregulated gene set to be displayed from the second downregulated gene set based on the ascending order.
[0025] The following operations are performed on the gene enrichment analysis results: determine the enrichment fold corresponding to the gene enrichment analysis results, sort the gene enrichment analysis results in descending order according to the enrichment fold, and extract the gene enrichment analysis results to be displayed from the gene enrichment analysis results based on the descending sort results;
[0026] One or more of the following can be used as the data to be displayed: the second set of upregulated genes to be displayed, the second set of downregulated genes to be displayed, and the gene enrichment analysis results to be displayed.
[0027] An intelligent label anti-overlap algorithm is used to generate interactive charts corresponding to the data to be displayed.
[0028] In one implementation, an intelligent tag anti-overlap algorithm is used to generate an interactive chart corresponding to the data to be displayed, including:
[0029] A two-dimensional coordinate system chart was constructed with the change in expression fold as the horizontal axis and the difference in expression ratio as the vertical axis, so as to plot the differential gene scatter points in the two-dimensional coordinate system chart;
[0030] The anchor point's x-coordinate is determined based on the largest difference in expression ratio.
[0031] Based on the baseline position of the differential gene scatter points in the two-dimensional coordinate system chart and the preset label repulsion force, the horizontal coordinate of the anchor point is adaptively offset to add text labels of the differential gene scatter points at the offset horizontal coordinate of the anchor point, so as to obtain an interactive chart corresponding to the data to be displayed. The content displayed in the text label includes at least the gene name information.
[0032] In one implementation, the visualization output module is further used for:
[0033] Obtain the gene attribute information to be queried, including the gene's location information on the UMAP map or the gene's name information;
[0034] Based on the target differential gene list and gene enrichment analysis results corresponding to the gene data information, generate multi-dimensional charts and / or statistical analysis charts;
[0035] It receives parameter adjustment parameters for multi-dimensional charts and statistical analysis charts, and updates these charts in real time.
[0036] Secondly, this invention also provides a Web-based intelligent analysis method for single-cell RNA sequencing data, comprising:
[0037] Receive cell populations via a web interface, which include RNA sequencing data from at least two single cells to be compared.
[0038] Differential gene analysis was performed on the single-cell RNA sequencing data contained in the cell population to obtain an original list of differentially expressed genes. A multi-threshold screening algorithm was then used to filter the original list of differentially expressed genes to obtain a target list of differentially expressed genes. The multi-threshold screening algorithm included at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold.
[0039] The target differential gene list is subjected to automatic species identification processing. Based on the results of the automatic species identification processing, the target local gene set database is called. The target differential gene list is subjected to parallel enrichment analysis without network connection based on the target local gene set database to obtain the gene enrichment analysis results.
[0040] An intelligent tagging anti-overlap algorithm is used to generate a list of target differentially expressed genes and / or interactive charts corresponding to the gene enrichment analysis results, so as to visualize the interactive charts.
[0041] Thirdly, the present invention also provides an electronic device including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement any of the methods provided in the second aspect.
[0042] Fourthly, the present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement any of the methods provided in the second aspect.
[0043] This invention provides a web-based intelligent analysis system and method for single-cell RNA sequencing data. The system includes a user interaction module for receiving cell populations via a web interface, each cell population comprising at least two single-cell RNA sequencing data sets to be compared; an intelligent anomaly analysis module for performing differential gene analysis on the single-cell RNA sequencing data within the cell population to obtain an initial list of differentially expressed genes, and then filtering the initial list using a multi-threshold filtering algorithm to obtain a target list of differentially expressed genes; wherein the multi-threshold filtering algorithm includes at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold; an offline enrichment analysis module for automatically identifying the species in the target list of differentially expressed genes, calling a target local gene set database based on the results of the automatic species identification, and performing parallel enrichment analysis on the target list of differentially expressed genes without relying on network connections, obtaining gene enrichment analysis results; and a visualization output module for generating interactive charts corresponding to the target list of differentially expressed genes and / or gene enrichment analysis results using an intelligent tagging anti-overlap algorithm, for visualizing the interactive charts. The above methods receive multi-group data through a web interface, significantly reducing the operational threshold for biomedical researchers. By introducing a triple threshold screening based on statistical significance, fold change in expression, and difference in expression ratio, low-expression noise genes are accurately removed, improving the biological reliability of differentially expressed marker genes. By automatically identifying species and matching them to a local database, manual mismatches and network dependencies are completely avoided. The use of a parallel computing framework to execute multiple enrichment tasks simultaneously can significantly improve the analysis results. Finally, through an intelligent labeling anti-overlap algorithm, the text annotations of differential gene scatter plots and enrichment entry bar charts are uniformly optimized, greatly improving the readability of charts and the depth of interactive exploration.
[0044] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained through the structures particularly pointed out in the description and the drawings.
[0045] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0046] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0047] Figure 1 A schematic diagram of the structure of a Web-based intelligent analysis system for single-cell RNA sequencing data provided in an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of the browser / service architecture used in a Web-based intelligent analysis system for single-cell RNA sequencing data provided in an embodiment of the present invention;
[0049] Figure 3 A flowchart illustrating a Web-based intelligent analysis method for single-cell RNA sequencing data, provided as an embodiment of the present invention;
[0050] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Currently, existing technologies suffer from high operational barriers, low efficiency in batch analysis, unstable results, and poor interactivity. Based on this, the present invention provides a Web-based intelligent analysis system and method for single-cell RNA sequencing data, which solves the above-mentioned technical problems of existing technologies and provides biomedical researchers with a one-stop analysis platform that is programming-free, efficient, stable, and has reproducible results.
[0053] To facilitate understanding of this embodiment, a detailed description of a Web-based intelligent analysis system for single-cell RNA sequencing data disclosed in this embodiment of the invention will be provided first. (See [link to documentation]). Figure 1 The diagram shown illustrates the structure of a web-based intelligent analysis system for single-cell RNA sequencing data, including:
[0054] User interaction module 102 is used to receive cell groups through a web interface.
[0055] The cell population includes at least two single-cell RNA sequencing data to be compared.
[0056] The intelligent anomaly analysis module 104 is used to perform differential gene analysis on the single-cell RNA sequencing data contained in the cell group to obtain the original differential gene list. The original differential gene list is then filtered using a multi-threshold screening algorithm to obtain the target differential gene list.
[0057] The multi-threshold screening algorithm includes at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold. In one implementation, the user selects single-cell RNA sequencing data to be compared and sets analysis parameters (including statistical significance threshold, expression fold change threshold, and expression ratio difference threshold) on a web interface. After the request is submitted to the server, the system calls analysis packages such as Seurat to perform differential expression analysis and obtain a raw list of differentially expressed genes. Then, the multi-threshold screening algorithm is applied: the difference in the proportion of cells expressing each gene between the two groups is calculated, and only genes that simultaneously meet the following three conditions are retained: statistical significance is less than the statistical significance threshold, the expression fold change is greater than the expression fold change threshold, and the expression ratio difference is greater than the expression ratio difference threshold. This algorithm effectively filters out noisy genes that are highly expressed only in a very small number of cells.
[0058] The offline enrichment analysis module 106 is used to perform automatic species identification processing on the target differential gene list, call the target local gene set database based on the results of the automatic species identification processing, and perform parallel enrichment analysis on the target differential gene list without relying on network connections based on the target local gene set database to obtain gene enrichment analysis results.
[0059] The gene enrichment analysis results include upregulated gene enrichment analysis results and / or downregulated gene enrichment analysis results. In one implementation, after receiving the target differentially expressed gene list, the system first automatically determines the species to which the target differentially expressed gene list belongs: by analyzing the naming characteristics of gene symbols (e.g., human genes are mostly all uppercase, while mouse genes are mostly the first letter capitalized), and performing double verification by combining the matching degree with the built-in multi-species feature gene database; after identification, the system automatically loads the target local gene set database corresponding to the species. The enrichment analysis is based on the hypergeometric test algorithm and completes all calculations locally; the system adopts a parallel computing framework, supporting the simultaneous execution of multiple tasks such as upregulated gene sets, downregulated gene sets, and different pathway databases, significantly improving the analysis speed.
[0060] The visualization output module 108 is used to generate an interactive chart corresponding to the target differential gene list and / or gene enrichment analysis results using an intelligent label anti-overlap algorithm, so as to visualize the interactive chart.
[0061] In one implementation, an intelligent label anti-overlap algorithm is employed: First, significant genes are sorted based on the difference in the proportion of expressed cells, and the top N genes with the strongest specificity are selected as the labeling objects; second, the offset direction and distance of each label are dynamically calculated based on their spatial distribution in the scatter plot; finally, the anti-overlap layout engine is invoked to complete the rendering, generating a highly readable chart. Users can interact in real time through zooming, panning, and hovering operations to view detailed information such as gene names and statistical indicators.
[0062] The web-based intelligent analysis system for single-cell RNA sequencing data provided in this invention receives multi-group data through a web interface, significantly reducing the operational threshold for biomedical researchers. By introducing a triple threshold screening based on statistical significance, fold change in expression, and difference in expression ratio, it accurately removes low-expression noise genes, improving the biological reliability of differentially expressed marker genes. By automatically identifying species and matching them to a local database, it completely avoids human mismatching and network dependence. The use of a parallel computing framework to execute multiple enrichment tasks simultaneously can significantly improve the analysis results. Finally, through an intelligent labeling anti-overlap algorithm, it uniformly optimizes the text annotation of differential gene scatter plots and enrichment entry bar charts, greatly improving the readability of charts and the depth of interactive exploration.
[0063] For ease of understanding, embodiments of the present invention provide a web-based intelligent analysis system for single-cell RNA sequencing data. See [link to relevant documentation]. Figure 2 The diagram illustrates a browser / service architecture for a web-based intelligent analysis system for single-cell RNA sequencing data: Users access the web application interface (user interaction module) through a browser. The backend server hosts the core analysis engine, including functional modules such as data preprocessing, differential analysis, and enrichment analysis. Analysis results are generated into charts through the visualization output module and returned to the front end for display.
[0064] Based on this, this invention provides a specific implementation of a Web-based intelligent analysis system for single-cell RNA sequencing data.
[0065] (I) Intelligent Difference Analysis Process:
[0066] Determine the statistical significance, fold change in expression, and difference in expression ratio for each gene in the original differentially expressed gene list;
[0067] Determine whether the statistical significance is less than the statistical significance threshold, whether the change in expression fold is greater than the change in expression fold threshold, and whether the difference in expression ratio is greater than the difference in expression ratio threshold.
[0068] If any judgment result is negative, the gene is removed from the original differential gene list to obtain the target differential gene list;
[0069] For the target differentially expressed gene list, perform the following operations: Based on the fold change in expression of each gene in the target differentially expressed gene list, divide the list into a second upregulated gene set and a second downregulated gene set; sort the genes in the second upregulated gene set in descending order according to the difference in expression ratio, and extract the second upregulated gene set to be displayed from the second upregulated gene set based on the descending order; sort the genes in the second downregulated gene set in ascending order according to the difference in expression ratio, and extract the second downregulated gene set to be displayed from the second downregulated gene set based on the ascending order.
[0070] An intelligent labeling anti-overlap algorithm is used to generate interactive charts corresponding to the second set of upregulated genes and / or the second set of downregulated genes to be displayed. Specifically, this includes: constructing a two-dimensional coordinate chart with fold change as the horizontal axis and expression ratio difference as the vertical axis; plotting differentially expressed gene scatter points in the two-dimensional coordinate chart; determining the horizontal coordinate of the anchor point based on the largest expression ratio difference; adaptively shifting the horizontal coordinate of the anchor point according to the baseline position of the differentially expressed gene scatter points in the two-dimensional coordinate chart and a preset label repulsion force; adding text labels for the differentially expressed gene scatter points at the shifted anchor point horizontal coordinates; and obtaining the interactive chart corresponding to the data to be displayed, where the text labels display at least the gene name information.
[0071] This invention provides pseudocode for intelligent difference analysis:
[0072] [1] Users select comparison groups via the web interface:
[0073] a. Select ident.1 and ident.2 for pickerInput.
[0074] | b. Set the log2FC threshold for sliderInput (default 1.0)
[0075] | c. The sliderInput sets the threshold value for p (default 0.05).
[0076] Specifically, first, the two cell group identifiers to be compared, namely ident.1 and ident.2, are specified through the drop-down selection box (pickerInput); then, the log2-fold change threshold is set through the slider (sliderInput), with a default value of 1.0 (corresponding to a 2-fold expression difference); finally, the corrected P-value threshold is set through the slider (sliderInput), with a default value of 0.05.
[0077] [2] Server-side reactive triggering:
[0078] │ observeEvent(input$run_deg_analysis, {
[0079] │# Parameter Validation
[0080] │validate(need(input$group1, "Please select comparison group 1"))
[0081] │validate(need(input$group2, "Please select comparison group 2"))
[0082] Specifically, when a user triggers the "Perform differential analysis" operation event, the system first performs a parameter integrity check: verifying whether the user has selected comparison group 1 (corresponding to the input variable `input$group1`) through the interface. If not selected, the system prompts "Please select comparison group 1"; simultaneously verifying whether comparison group 2 (corresponding to the input variable `input$group2`) has been selected. If not selected, the system prompts "Please select comparison group 2". Only after both parameters are validly entered will the analysis process continue.
[0083] [3] Call the Seurat differential analysis engine:
[0084] │ markers<- FindMarkers(
[0085] |object = obj$so,
[0086] |ident.1 = input$group1,
[0087] |ident.2 = input$group2,
[0088] │test.use = input$test_method,# wilcox / t / MAST
[0089] │logfc.threshold = input$logfc,
[0090] |min.pct = 0.1
[0091] Specifically, the system calls the differential expression analysis function `FindMarkers`, using the single-cell expression matrix object `obj$so` as the input data source, and performs statistical inference: (1) Specify the identifiers of the two cell groups to be compared, namely the user-selected comparison group 1 (`input$group1`) and comparison group 2 (`input$group2`); (2) Use the statistical test method specified by the user (supporting Wilcoxon rank-sum test, t test or MAST model); (3) Set the expression fold change filtering threshold to the user-input `input$logfc`; (4) Set the gene expression filtering condition: only retain genes that are detected to be expressed in at least 10% of the cells in either group (`min.pct = 0.1`). This step outputs the original differential gene list `markers` containing the average log2 fold change value of each gene (`avg_log2FC`, i.e., expression fold change), the corrected P value (`p_val_adj`, i.e., statistical significance), the proportion of expressing cells in the two groups (`pct.1`, `pct.2`), etc.
[0092] [4] Dual threshold filtering algorithm:
[0093] │ markers$pct_diff<- markers$pct.1 - markers$pct.2
[0094] │ markers_sig<- markers %>%
[0095] │filter(
[0096] │abs(avg_log2FC)>input$logfc&
[0097] │p_val_adj <input$pval&
[0098] |abs(pct_diff)>input$pct_threshold# Add a new dimension
[0099] │)
[0100] Specifically, the system first calculates the difference in the proportion of cells expressing each gene between the two groups, i.e.: `pct_diff = pct.1` pct.2; Subsequently, perform triple conditional screening on the original differential gene list "markers", and only retain genes that simultaneously meet the following three conditions to form a high-quality target differential gene list "markers_sig": (1) The absolute value of the average log2 fold change is greater than the user-set expression fold change threshold (abs(avg_log2FC) > input$logfc); (2) The adjusted P-value is less than the user-set statistical significance threshold (p_val_adj < input$pval); (3) The absolute value of the difference in the proportion of expressing cells is greater than the user-set expression specificity threshold (abs(pct_diff) > input$pct_threshold), which is the newly added third-dimensional screening criterion in this invention.
[0101] Compared with the problem that traditional algorithms may include low-expression genes (i.e., noise), the embodiments of this invention can achieve the following technical effects: effectively filter out low-signal-to-noise genes that are accidentally expressed only in a very small number of cells, significantly reduce false-positive markers caused by technical noise or batch effects; focus on identifying biologically relevant markers with high expression specificity between cell groups, and improve the interpretability of the results and the success rate of downstream verification. For example, 500 significant genes were screened by traditional double thresholds (P-value + log2FC), and a large number of them were interfering genes with low expression and cross-group pan-expression; after the embodiments of this invention introduced the difference in the proportion of expressing cells (pct_diff) as the third-dimensional biological rationality criterion, it was refined to 150 high-quality markers, and both the specificity and the significance of functional enrichment were greatly improved.
[0102] The principle by which the embodiments of this invention can achieve the above technical effects is as follows:
[0103] `pct.1`: The proportion of cells in which this gene is expressed (count value > 0) in group 1 (value range 0–1);
[0104] `pct.2`: The proportion of cells in which this gene is expressed in group 2;
[0105] `pct_diff = pct.1 pct.2`: The absolute difference in the proportion of expressing cells between the two groups. The larger its absolute value, the more it indicates that this gene is "switch-type" specifically expressed in a certain group, and the stronger the marker potential;
[0106] For example, `pct_diff = 0.8 0.1 = 0.7`, that is, this gene is expressed in 30% of the cells in group 1 and only 10% of the cells in group 2, with high group specificity and is an ideal candidate marker.
[0107] [5] Intelligent gene tagging algorithm:
[0108] │ # Upregulated genes: Top N sorted by pct_diff
[0109] │ up_genes<- markers_sig %>%
[0110] |filter(avg_log2FC>0) %>%
[0111] │arrange(desc(pct_diff)) %>%
[0112] │slice_head(n = input$n_label)
[0113] │
[0114] │ # Downregulated genes: Top N sorted by pct_diff
[0115] │ down_genes<- markers_sig %>%
[0116] |filter(avg_log2FC<0) %>%
[0117] │arrange(pct_diff) %>%
[0118] │slice_head(n = input$n_label)
[0119] Specifically, the system divides the high-quality target differential gene list `markers_sig` into two categories: upregulated and downregulated.
[0120] For the subset of upregulated genes, genes with `avg_log2FC>0` are selected, and then sorted from largest to smallest according to the difference in the proportion of cells expressing the gene (`pct_diff`). The top `n` genes (`n` is the number of labels to be displayed by the user `input$n_label`) are selected to form a high-priority set of upregulated genes `up_genes`.
[0121] For the downregulated gene subset, genes with `avg_log2FC<0` are selected, and then sorted in ascending order by the difference in the proportion of cells expressing the gene (`pct_diff`). The top `n` genes in the sorted subset are selected to form a high-priority downregulated gene set `down_genes`.
[0122] [6] Generate interactive visualizations:
[0123] │ plot_obj<- ggplot(markers, aes(x=avg_log2FC, y=pct_diff)) +
[0124] │geom_point(aes(color=group), size=2, alpha=0.6) +
[0125] │ggrepel::geom_text_repel(# Smart tags to avoid overlap)
[0126] │data = rbind(up_genes, down_genes),
[0127] |aes(label = gene),
[0128] |max.overlaps = Inf,
[0129] |force = 2,# Repulsion coefficient
[0130] |nudge_x = ...# Adaptive offset
[0131] │) +
[0132] │geom_vline(xintercept = c(-input$logfc, input$logfc))
[0133] │
[0134] │ # Convert to an interactive Plotly chart
[0135] │ interactive_plot<- ggplotly(plot_obj, tooltip = c("gene", "p_val"))
[0136] Specifically, the system constructs a two-dimensional scatter plot based on the original differentially expressed gene list `markers`, using the average log2-fold change (`avg_log2FC`) as the x-axis and the difference in the proportion of expressing cells (`pct_diff`) as the y-axis. Different colors are used to distinguish upregulated and downregulated genes, and the point size is uniformly set to 2 and the transparency to 0.6, balancing clarity and density readability. The intelligent label layout function `ggrepel::geom_text_repel()` is called to add text labels only to the subset of genes (`rbind(up_genes, down_genes)`) after merging the high-priority upregulated and downregulated gene sets. The label content is the gene name. Label layout parameters are set: allowing unlimited overlap attempts to ensure all labels are forced to display (`max.overlaps = Inf`), enhancing the repulsion force to avoid adhesion (`force = 2`), and adopting an adaptive horizontal offset strategy (`nudge_x` dynamically calculated). Two vertical reference lines are added (`xintercept = ...). The `±input$logfc`` method helps users intuitively identify regions of significant upregulation, insignificance, and significant downregulation. Finally, the static ggplot chart is encapsulated into an interactive `plotly` chart, which supports zooming, panning, and hovering to display gene names and corrected P-values.
[0137] Experiments have shown that using the basic `geom_text` static text annotation method results in a label overlap rate exceeding 30%, leading to numerous gene names obscuring each other, resulting in poor readability and visual appeal. The intelligent avoidance scheme using the default parameters of `ggrepel` can reduce the label overlap rate to approximately 30%, achieving a moderate level of readability and aesthetics, but still exhibiting issues of localized overlap and rigid layout. This embodiment of the invention employs an intelligent labeling algorithm that strictly controls the label overlap rate to within 5%, significantly improving the information density and recognition efficiency of the charts, while ensuring a balanced layout, clear lines, and a professional visual appearance, achieving superior readability and aesthetics.
[0138] [7] Store the results in a reactive object:
[0139] │ obj$marker_df<- markers_sig
[0140] │ obj$plot_object_deg<- interactive_plot
[0141] Specifically, the system stores the high-quality target differential gene list `markers_sig` obtained through triple threshold screening into the `marker_df` field of the responsive object `obj`, as structured data input for downstream analysis (such as enrichment analysis); at the same time, it stores the encapsulated interactive scatter plot object `interactive_plot` into the `plot_object_deg` field of the same responsive object `obj`, for real-time rendering and user interaction by the front end.
[0142] [8] Automatically trigger enrichment analysis (optional):
[0143] │ if(input$auto_enrichment) {
[0144] | Observe changes in obj$marker_df → trigger enrichment process
[0145] │}
[0146] Specifically, if the user enables the automatic enrichment analysis switch (`input$auto_enrichment` is true), the system will listen for changes in the reactive object `obj$marker_df`; once an update to this field is detected (i.e., a high-quality differential gene list is generated or changed), the offline enrichment analysis process will be automatically triggered immediately.
[0147] In one example, within a reactive programming framework (such as R Shiny), `obj$marker_df` acts as a reactive object. Its changes are typically triggered by two scenarios: Scenario 1: User-initiated adjustment of analysis parameters: When a user modifies the differential analysis thresholds (e.g., log2FC, P-value) or changes the control group via the interface and clicks "Run Differential Analysis," the system re-executes the analysis process and generates a new gene list, thus updating `obj$marker_df`. Scenario 2: Data source update: When a user uploads new data or switches the analysis object, causing changes to the underlying single-cell data object, the differential analysis results that depend on that data are automatically updated.
[0148] (II) Offline Batch Enrichment Analysis Process:
[0149] Extract the name features of the target differential gene list, and make a preliminary determination of the species to which the target differential gene list belongs based on the name features and the preset gene naming rules;
[0150] If the initial determination fails, the target differential gene list is matched with a pre-stored multi-species characteristic gene library to determine the species to which the target differential gene list belongs based on the gene matching results.
[0151] The target local gene set database is accessed based on the results of automatic species identification processing.
[0152] Based on the fold change in expression of each gene in the target differentially expressed gene list, the target differentially expressed gene list is divided into a first upregulated gene set and a first downregulated gene set;
[0153] Based on the target local gene set database, offline parallel enrichment processing is performed on the first upregulated gene set and / or the first downregulated gene set to obtain the upregulated gene enrichment analysis results and / or the downregulated gene enrichment analysis results.
[0154] The following operations are performed on the gene enrichment analysis results: determine the enrichment fold corresponding to the gene enrichment analysis results, sort the gene enrichment analysis results in descending order according to the enrichment fold, and extract the gene enrichment analysis results to be displayed from the gene enrichment analysis results based on the descending sort results;
[0155] An intelligent tagging anti-overlap algorithm is used to generate interactive charts corresponding to the gene enrichment analysis results to be displayed.
[0156] This invention provides pseudocode for an offline batch enrichment analysis workflow:
[0157] [1] List of differentially received genes:
[0158] │ input: obj$marker_df (from DEG analysis)
[0159] │or a list of genes manually entered by the user
[0160] Specifically, the input sources for the enrichment analysis module include two types: one is a high-quality list of differentially expressed genes (i.e., a responsive object `obj$marker_df`) output by the differential expression analysis module; the other is a list of gene symbols (such as CSV files or text format) manually uploaded or pasted by the user through the web interface, used for custom enrichment analysis.
[0161] [2] Automatic species identification:
[0162] │ species<- detect_species(obj$so)
[0163] │ # Check gene name characteristics:
[0164] │ # Human: SYMBOL (TP53, GAPDH)
[0165] │ # Mice: First letter capitalized (Tp53, Gapdh)
[0166] │ if(species == "unknown") {
[0167] │# Matching degree test with gene database
[0168] │human_match<- sum(genes %in% human_genes_info$symbol)
[0169] │mouse_match<- sum(genes %in% mouse_genes_info$symbol)
[0170] │species<- ifelse(human_match>mouse_match, "human", "mouse")
[0171] │}
[0172] Specifically, the system calls the species identification function `detect_species()`, which determines the species based on the gene symbols (`rownames(obj$so)`) of the original single-cell object `obj$so`.
[0173] First, a preliminary judgment is made according to the gene naming rules: if more than 30% of the gene symbols are in all uppercase format (such as `TP53`, `GAPDH`), then it is preliminarily determined to be human; if more than 30% are in the format of the first letter capitalized and the rest lowercase (such as `Tp53`, `Gapdh`), then it is preliminarily determined to be mouse.
[0174] If the initial judgment result is "unknown", then a second verification is initiated: the number of matches between the input gene and the pre-set human characteristic gene database (`human_genes_info$symbol`) and mouse characteristic gene database (`mouse_genes_info$symbol`) is calculated and denoted as `human_match` and `mouse_match` respectively; if `human_match>mouse_match`, then it is finally determined to be human, otherwise it is determined to be mouse.
[0175] [3] Automatically load species database:
[0176] │ if(species == "human") {
[0177] │OrgDb<- org.Hs.eg.db
[0178] │gmt_files<- list.files("extdata / gprofiler / hsapiens. .gmt")
[0179] │} else {
[0180] │OrgDb<- org.Mm.eg.db
[0181] │gmt_files<- list.files("extdata / gprofiler / mmusculus. .gmt")
[0182] │}
[0183] Specifically, the corresponding analysis resources are automatically loaded based on the species identification results:
[0184] If the result is determined to be human, the human gene annotation database `org.Hs.eg.db` is loaded, and all matching patterns `hsapiens` in the local path `extdata / gprofiler / ` are read. .gmt path definition files (such as `hsapiens.GO_BP.name.gmt`, `hsapiens.KEGG.gmt`, etc.);
[0185] If the mouse is identified, the mouse gene annotation database `org.Mm.eg.db` is loaded, and all matching patterns `mmusculus` in the same path are read. The .gmt file is a path definition file.
[0186] [4] Gene list grouping (up-regulation / down-regulation):
[0187] │ up_genes<- filter(marker_df, avg_log2FC>logfc_threshold)$gene
[0188] │ down_genes<- filter(marker_df, avg_log2FC<-logfc_threshold)$gene
[0189] Specifically, the system groups genes based on a high-quality target differential gene list `marker_df`, according to the average log2-fold change value (`avg_log2FC`):
[0190] Extract all genes whose `avg_log2FC` is greater than the user-defined upregulation threshold (`logfc_threshold`) and form the upregulated differential gene set `up_genes`.
[0191] Extract the negative of `avg_log2FC` that is less than the threshold (i.e., `avg_log2FC < ... ) All genes in logfc_threshold constitute the downregulated differential gene set down_genes.
[0192] [5] Parallel enrichment analysis:
[0193] | future::plan(multisession, workers = 4) # 4-core parallel processing
[0194] │
[0195] │ # Upregulation of gene enrichment
[0196] │ go_up %<-% {# Asynchronous execution
[0197] │enrichGO(
[0198] |gene = up_genes,
[0199] │OrgDb = OrgDb,
[0200] |ont = "ALL", # Simultaneous analysis of BP+CC+MF
[0201] |pAdjustMethod = "BH"
[0202] │)
[0203] │}
[0204] │
[0205] │ # Downregulate gene enrichment (concurrently)
[0206] │ go_down %<-% {
[0207] │enrichGO(gene = down_genes, OrgDb = OrgDb, ont = "ALL")
[0208] │}
[0209] │
[0210] │ # Offline GMT database enrichment (performed simultaneously)
[0211] │ kegg_result %<-% {
[0212] │gmt_data<- read_gmt("extdata / gprofiler / hsapiens.KEGG.gmt")
[0213] │enricher(
[0214] │gene = c(up_genes, down_genes),
[0215] │TERM2GENE = gmt_data,
[0216] |pvalueCutoff = 0.05
[0217] │)
[0218] │}
[0219] │
[0220] │ # Waiting for all tasks to complete
[0221] │ results<- list(go_up = go_up, go_down = go_down, kegg = kegg_result)
[0222] Specifically, the system employs a multi-process parallel computing framework (`future::plan(multisession, workers= 4)`) to simultaneously launch three independent asynchronous enrichment analysis tasks:
[0223] Up-enriching of genes for GO: The `enrichGO` function is called, with `up_genes` as the input gene list and `OrgDb` as the species-matched annotation database as the mapping basis. `ont = "ALL"` is set to cover the three major ontology of biological processes (BP), cellular components (CC), and molecular functions (MF). The Benjamini-Hochberg (BH) method is used to perform multiple tests to correct the original P-value.
[0224] GO enrichment of downregulated genes: Use `down_genes` as input, and perform the same parameters as the upregulation analysis simultaneously.
[0225] Offline GMT pathway enrichment: First, read the KEGG pathway definition file (e.g., `hsapiens.KEGG.gmt`) from the local path, parse it into a standard pathway-gene mapping structure (`TERM2GENE`), and then call the general enrichment function `enricher`. With all differentially expressed genes after merging (`c(up_genes, down_genes)`) as input, use the original p-value truncation threshold `0.05` for filtering.
[0226] After the three tasks are completed in parallel, the system collects the results and integrates them into a list of results containing three types of output: GO upregulation, GO downregulation, and KEGG enrichment.
[0227] Furthermore, the offline enrichment analysis in this embodiment of the invention employs a hypergeometric verification algorithm, the pseudocode of which is shown below:
[0228] universe_size<- length(unique(gmt_data$gene))
[0229] query_size <- length(genes)
[0230] results<- gmt_data %>%
[0231] group_by(term, name) %>%
[0232] summarise(
[0233] geneset_size = n(),
[0234] overlap = sum(gene %in% genes),
[0235] genes_in_term = paste(gene[gene %in% genes], collapse = " / ")
[0236] ) %>%
[0237] filter(overlap>0) %>%
[0238] mutate(
[0239] # Hypergeometric test p-value
[0240] pvalue = phyper(
[0241] q = overlap - 1,
[0242] m = geneset_size,
[0243] n = universe_size - geneset_size,
[0244] k = query_size,
[0245] lower.tail = FALSE
[0246] ),
[0247] # FDR Correction
[0248] p.adjust = p.adjust(pvalue, method = "BH"),
[0249] # Enrichment factor
[0250] fold_enrichment = (overlap / query_size) /
[0251] (geneset_size / universe_size)
[0252] ) %>%
[0253] arrange(pvalue)
[0254] return(results)
[0255] }
[0256] Its meaning is as follows:
[0257] First, determine the size of the background gene set: `universe_size` is the total number of all unique genes (`unique(gmt_data$gene)`) in the GMT file, representing the entire gene set covered by the current pathway database; `query_size` is the length of the user-input gene list `genes`, i.e. the number of genes to be analyzed.
[0258] Group the GMT data by pathway entry (`term`) and pathway name (`name`), and calculate for each entry: the total number of genes contained in the pathway (`geneset_size`); the number of intersections with the input genes (`overlap`); and the specific gene symbols in the intersection (stored as strings connected by " / " in `genes_in_term`).
[0259] Filter out paths with no overlap (`overlap = 0`);
[0260] Perform hypergeometric checks on each of the remaining pathways: using `overlap` 1 is the critical value (q). The probability of observing at least `overlap` intersection genes in the hypergeometric distribution is calculated (phyper(..., lower.tail =FALSE)) to obtain the original P value (pvalue).
[0261] All P-values were corrected using the Benjamini-Hochberg (BH) method with multiple tests to generate FDR correction values (`p.adjust`).
[0262] The enrichment fold (`fold_enrichment`) is defined as the ratio of the proportion of input genes belonging to this pathway (`overlap / query_size`) to the proportion of background genes belonging to this pathway (`geneset_size / universe_size`).
[0263] The final results are sorted in ascending order by the original P-value and returned as a structured data frame containing pathway ID, name, pathway size, number of intersections, list of intersection genes, P-value, FDR correction value, and enrichment fold.
[0264] The embodiments of the present invention can achieve the following effects: (1) Completely offline operation: All analysis modules (species identification, enrichment calculation, visualization rendering) do not rely on network connection and are suitable for intranet or isolated environments of hospitals, pharmaceutical companies and research institutions; (2) Strict version locking: The versions of local gene annotation library and pathway database (such as GO, KEGG GMT files) are fixed, completely eliminating the result drift caused by dynamic updates of online resources, and ensuring 100% reproducibility of cross-time and cross-platform analysis; (3) Extreme computing performance: Based on efficient R / C++ underlying and parallel optimization, it only takes <5 seconds to complete the full hypergeometric test of 500 genes against 20,000 pathways; (4) Unrestricted batch processing: It is not limited by API call frequency, concurrency or quota, and supports submitting a list of 100+ independent genes for parallel analysis at one time (such as multiple groups of differential genes, multi-time point marker sets, etc.).
[0265] [6] Results integration and annotation:
[0266] │ go_up_df<- go_up@result %>% mutate(group = "Up-regulated")
[0267] │ go_down_df<- go_down@result %>% mutate(group = "Down-regulated")
[0268] │ combined_go<- rbind(go_up_df, go_down_df)
[0269] │
[0270] │ # Calculate enrichment factor
[0271] │ combined_go$GeneRatio_numeric<- sapply(combined_go$GeneRatio,
[0272] │function(x) eval(parse(text = x)))
[0273] │ combined_go$enrichment_score<- -log10(combined_go$pvalue)
[0274] │combined_go$GeneRatio_numeric
[0275] Specifically, the system performs structured integration of the three enrichment analysis results:
[0276] Add grouping identifier fields to the GO enrichment results of upregulated genes (`go_up@result`) and downregulated genes (`go_down@result`) with values of "Up-regulated" and "Down-regulated" respectively;
[0277] The two are merged to form a unified GO enrichment result table `combined_go`;
[0278] For the `GeneRatio` field in this table (originally in string format, such as `"5 / 200"`), parse each row to calculate its numerical ratio (i.e., `5 ÷ 200 = 0.025`), and store it in a new column `GeneRatio_numeric`;
[0279] Based on this, the enrichment significance enhancement index `enrichment_score` for each GO entry is further calculated, which is defined as: the degree of statistical significance (in terms of `...`) log 10The product of (pvalue) and biological enrichment intensity (represented by `GeneRatio_numeric`).
[0280] [7] Intelligent Visualization Selection:
[0281] │ # Automatically select top items to avoid chart overload
[0282] │ top_terms<- combined_go %>%
[0283] │group_by(group, ONTOLOGY) %>%
[0284] │arrange(desc(enrichment_score)) %>%
[0285] │slice_head(n = input$n_terms_show)# User-adjustable
[0286] │
[0287] │ # Generate a comparison bar chart
[0288] │ plot<- ggplot(top_terms, aes(x = enrichment_score,
[0289] |y = Description,
[0290] │fill = group)) +
[0291] │geom_col() +
[0292] │facet_wrap(~ONTOLOGY, scales = "free_y") +
[0293] │scale_fill_manual(values = c("Up-regulated" = "#EB4232",
[0294] │"Down-regulated" = "#2DB2EB"))
[0295] Specifically, to avoid information overload in the charts, the system automatically filters high-value enrichment items: the integrated GO enrichment result table `combined_go` is grouped by group (`group`) and ontology type (`ONTOLOGY`, such as BP, CC, MF); within each group, items are sorted from high to low according to the enrichment significance enhancement index `enrichment_score`, and a user-specified number (`input$n_terms_show`) of top items are selected to form a concise display set `top_terms`; based on this, a faceted bar chart is generated: `enrichment_score` is used as the x-axis and `Description` as the y-axis, filled with different colors according to the group (`group`); a faceted layout (`facet_wrap`) is used, with automatic pagination according to ontology type (`ONTOLOGY`), and each page's y-axis is independently scaled (`scales = ...). "free_y"`); Manually set the color scheme: use red for related items that are raised (`#EB4232`), and blue for related items that are lowered (`#2DB2EB`).
[0296] [8] Result storage and export:
[0297] │ obj$enrichment_result<- combined_go
[0298] │ obj$plot_enrichment<- plot
[0299] │
[0300] │ # One-click export to Excel (multiple sheets)
[0301] │ if(input$export_enrichment) {
[0302] |wb<- createWorkbook()
[0303] │addWorksheet(wb, "GO_Up")
[0304] │writeData(wb, "GO_Up", go_up_df)
[0305] │addWorksheet(wb, "GO_Down")
[0306] │writeData(wb, "GO_Down", go_down_df)
[0307] │addWorksheet(wb, "KEGG")
[0308] │writeData(wb, "KEGG", kegg_result@result)
[0309] │saveWorkbook(wb, "enrichment_results.xlsx")
[0310] │}
[0311] Specifically, the system stores the integrated and complete GO enrichment result table `combined_go` into the `enrichment_result` field of the responsive object `obj`, serving as the data source for downstream analysis and export; at the same time, it stores the generated faceted bar chart object `plot` into the `obj$plot_enrichment` field for front-end rendering and display.
[0312] If the user enables the enrichment result export function (`input$export_enrichment` is true), the system automatically creates an Excel workbook and organizes multiple worksheets according to the following structure:
[0313] Create a new worksheet named "GO_Up" and write the GO enrichment results of upregulated genes (`go_up_df`).
[0314] Create a new worksheet named "GO_Down" and write the GO enrichment results of downregulated genes (`go_down_df`).
[0315] Create a new worksheet named "KEGG" and write the KEGG pathway enrichment results (`kegg_result@result`).
[0316] Finally, the workbook is saved as the file `enrichment_results.xlsx`, enabling one-click batch export.
[0317] (III) Interactive Exploration Process:
[0318] Obtain the gene attribute information to be queried, including the gene's location information on the UMAP map or the gene's name information;
[0319] Based on the target differential gene list and gene enrichment analysis results corresponding to the gene data information, generate multi-dimensional charts and / or statistical analysis charts;
[0320] It receives parameter adjustment parameters for multi-dimensional charts and statistical analysis charts, and updates these charts in real time.
[0321] This invention provides pseudocode for an interactive exploration process:
[0322] [1] The user clicks on a cell on the UMAP map:
[0323] │ observeEvent(input$plotly_click, {
[0324] │clicked_point<- event_data("plotly_click")
[0325] │cell_barcode<- get_cell_from_coords(
[0326] |x = clicked_point$x,
[0327] │y = clicked_point$y
[0328] │)
[0329] Specifically, when a user clicks on an interactive Plotly chart, the system listens for the event via `observeEvent(input$plotly_click, {...})` and captures the coordinate data of the click location in real time (`event_data("plotly_click")`). Subsequently, it calls the coordinate mapping function `get_cell_from_coords()` to convert the captured x-coordinate (x) and y-coordinate (y) into a unique molecular barcode for the corresponding single cell, thereby achieving precise backtracking from the visualized element to the original sequencing unit.
[0330] [2] Real-time display of cell information:
[0331] │ cell_info<- obj$so@meta.data[cell_barcode, ]
[0332] │ output$cell_info_box<- renderUI({
[0333] │tagList(
[0334] │h4("Cell Information"),
[0335] │p("Barcode:", cell_barcode),
[0336] │p("Cluster:", cell_info$seurat_clusters),
[0337] │p("Cell Type:", cell_info$celltype),
[0338] │p("nCount_RNA:", cell_info$nCount_RNA),
[0339] │p("nFeature_RNA:", cell_info$nFeature_RNA)
[0340] │)
[0341] │})
[0342] Specifically, based on the captured cell barcode `cell_barcode`, the system extracts all annotation information of the cell from the metadata table (`@meta.data`) of the single cell object `obj$so` and stores it in the variable `cell_info`.
[0343] Subsequently, the `renderUI` method dynamically generates the front-end display module `output$cell_info_box` to present the cell's key attributes in a structured manner.
[0344] The title is "Cell Information";
[0345] The main text displays the following information in sequence: unique cell barcode (`Barcode`), Seurat cluster number (`Cluster`), cell type (`Cell Type`) labeled manually or by algorithm, total number of RNA molecules (`nCount_RNA`), and number of detected genes (`nFeature_RNA`).
[0346] All fields are directly derived from the metadata of the original analysis object, ensuring that the information is authentic, traceable, and without secondary processing.
[0347] [3] User inputs genes of interest:
[0348] │ observeEvent(input$gene_search, {
[0349] │genes<- strsplit(input$gene_input, "[,; \n]+")[[1]]
[0350] |genes<- trimws(genes)# Remove spaces
[0351] Specifically, when a user submits a query in the gene search input box (triggers the `input$gene_search` event), the system automatically parses the input content:
[0352] The user-input string (`input$gene_input`) is split by commas, semicolons, spaces, or newlines (regular expression pattern `[,; \\n]+`) to obtain a list of gene symbols;
[0353] Perform `trimws` on each element in the list to ensure that gene names are formatted correctly and free of redundant spaces, providing clean input for subsequent matching and enrichment analysis.
[0354] [4] Gene name verification and conversion:
[0355] │ # Check if the gene exists
[0356] │ valid_genes<- genes[genes %in% rownames(obj$so)]
[0357] │ invalid_genes<- genes[!genes %in% rownames(obj$so)]
[0358] │
[0359] │ if(length(invalid_genes)>0) {
[0360] │# Attempt ID conversion
[0361] │converted<- bitr(
[0362] │invalid_genes,
[0363] │fromType = "ENSEMBL",
[0364] |toType = "SYMBOL",
[0365] │OrgDb = OrgDb
[0366] │)
[0367] │valid_genes<- c(valid_genes, converted$SYMBOL)
[0368] │}
[0369] │
[0370] │ # Display warning message
[0371] │ if(length(invalid_genes)>0) {
[0372] │showNotification(
[0373] │paste("Gene not found:", paste(invalid_genes, collapse = ", ")),
[0374] |type = "warning"
[0375] │)
[0376] │}
[0377] Specifically, the system first verifies whether each gene in the user-input gene list exists in the line name (i.e., gene symbol) of the current single-cell object `obj$so`:
[0378] Genes that match successfully are stored in `valid_genes`, and genes that do not match are stored in `invalid_genes`.
[0379] If unmatched genes exist, the automatic ID conversion mechanism is activated: the `biomaRt::bitr()` function is called, taking `invalid_genes` as input, and based on the species-matched annotation database `OrgDb`, it attempts to convert them in batches from ENSEMBL ID format (such as `ENSG00000141510`) to standard gene symbols (`SYMBOL`), and appends the successfully converted symbols to `valid_genes`;
[0380] If unidentifiable genes still exist after conversion (i.e., the original input is not a standard symbol and has no corresponding ENSEMBLID), the system will pop up a warning through the front-end notification component `showNotification()`, clearly listing all the names of the unfound genes and marking them as "warning" level prompts to ensure that users are aware and that the information is traceable.
[0381] [5] Dynamically generate multi-dimensional charts:
[0382] │ # Violin Picture
[0383] | violin_plot<- VlnPlot(
[0384] │obj$so,
[0385] │features = valid_genes,
[0386] │group.by = input$group_by,
[0387] │pt.size = 0
[0388] │ )
[0389] │
[0390] │ # Feature plot (UMAP)
[0391] │ feature_plot<- FeaturePlot(
[0392] │obj$so,
[0393] │features = valid_genes,
[0394] │reduction = "umap",
[0395] │cols = c("lightgrey", "red")
[0396] │ )
[0397] │
[0398] │ # Dot plot
[0399] │ dot_plot<- DotPlot(
[0400] │obj$so,
[0401] │features = valid_genes,
[0402] │group.by = input$group_by
[0403] │ ) + RotatedAxis()
[0404] │
[0405] │ # Combined display (patchwork)
[0406] │ combined_plot<- (feature_plot | violin_plot) / dot_plot
[0407] Specifically, based on the validated and converted list of valid genes `valid_genes`, the system simultaneously generates three types of complementarity visualization charts:
[0408] Violin Plot: Calls the `VlnPlot` function to display the expression distribution density and median trend of each gene in different cell groups under the specified grouping variable (`input$group_by`). The point size is set to 0 to highlight the outline shape.
[0409] Feature Plot: The `FeaturePlot` function is called to map gene expression intensity to the UMAP dimensionality reduction space. A two-color gradient of gray-white (background) and red (high expression) is used to visually present the spatial location of genes in cell subpopulations.
[0410] Dot Plot: Calls the `DotPlot` function to represent the proportion of expressing cells by the size of the dots, the color intensity by the average expression level, and enables axis rotation (`RotatedAxis()`) to improve the readability of multi-gene tags;
[0411] Finally, the three plots are intelligently combined using the `patchwork` layout syntax `(feature_plot | violin_plot) / dot_plot`: the upper layer displays the UMAP feature plot and violin plot side by side, and the lower layer displays the dot plot in the center, forming a comprehensive analysis view with a clear structure and complementary information.
[0412] [6] Real-time statistical analysis:
[0413] │ # Calculate the average expression and expression ratio of genes in each group
[0414] │ expr_summary<- obj$so@assays$RNA@data[valid_genes, ] %>%
[0415] |as.matrix() %>%
[0416] │t() %>%
[0417] |as.data.frame() %>%
[0418] │mutate(group = obj$so@meta.data[[input$group_by]]) %>%
[0419] │group_by(group) %>%
[0420] │summarise(across(everything(),
[0421] │list(
[0422] |mean = ~mean(expm1(.)), # Inverse log transformation
[0423] |pct = ~sum(.>0) / n() 100
[0424] │)
[0425] │))
[0426] │
[0427] │ # Display as an interactive table
[0428] │ output$expr_table<- renderDT({
[0429] │datatable(
[0430] │expr_summary,
[0431] │options = list(pageLength = 20, scrollX = TRUE),
[0432] |filter = "top"# Top filter
[0433] │)
[0434] │})
[0435] Specifically, based on the valid gene list `valid_genes`, the system extracts the corresponding row data from the original RNA counting matrix (`@assays$RNA@data`) of the single-cell object `obj$so`, and performs the following calculations:
[0436] Convert the sparse matrix to a normal matrix, transpose it, and then convert it to a data frame.
[0437] Add a grouping column (`group`) whose value is taken from the user-specified grouping variable (`obj$so@meta.data[[input$group_by]]`) in the metadata table.
[0438] Aggregate the data according to the grouping, and calculate two core metrics for each gene within each group: mean expression level: convert log-transformed data back to the original count scale using `expm1()`, and then calculate the arithmetic mean (`mean`); proportion of cells expressing the gene: count the percentage of cells with an expression value greater than 0 within the group, expressed as a percentage (`pct`).
[0439] Finally, a structured summary table `expr_summary` is generated, and `renderDT()` is called to render it as an interactive data table: it supports top global filtering, displays 20 rows per page, and allows horizontal scrolling to view all genes and grouping indicators, making it easy for users to quickly screen and compare.
[0440] [7] Real-time parameter adjustment:
[0441] │ # Users drag the slider to change the color scheme
[0442] │ observeEvent(input$color_scale, {
[0443] │# No need to recalculate, only update the chart color scheme
[0444] │feature_plot<- feature_plot +
[0445] │scale_color_gradientn(colors = input$color_palette)
[0446] │output$feature_plot<- renderPlot(feature_plot)
[0447] │})
[0448] │
[0449] │ # User selects subset cells
[0450] │ observeEvent(input$subset_clusters, {
[0451] |obj$so_subset<- subset(
[0452] │obj$so,
[0453] │subset = seurat_clusters %in% input$selected_clusters
[0454] │)
[0455] │# Automatically update all related charts
[0456] │})
[0457] Specifically, the system supports two real-time interactive responses:
[0458] Dynamic color updates: When the user drags the color map slider (`input$color_scale`), the system does not recalculate the UMAP coordinates or gene expression values. Instead, it overlays a new gradient color scale (`scale_color_gradientn(colors = input$color_palette)`) on the existing `feature_plot` and immediately re-renders it to the front end `output$feature_plot`, achieving millisecond-level color switching.
[0459] Dynamic cell subset filtering: When a user selects a target group in the cluster selection control (triggered by `input$subset_clusters`), the system calls the `subset()` function. Based on the `seurat_clusters` field in the metadata, it extracts a subset of cells from the original object `obj$so` and stores it in `obj$so_subset`. This operation automatically triggers all subsequent analysis and visualization modules that depend on `obj$so_subset` (such as difference analysis, UMAP redraw, violin plot, etc.) to update synchronously, forming a closed-loop response.
[0460] In summary, the system provided by the embodiments of the present invention has at least the following characteristics:
[0461] (1) Significantly reduced usage threshold: This invention provides an intuitive web graphical interface, allowing users to complete the entire analysis process without programming, enabling biological researchers to operate independently and reducing the learning cost by more than 95%. The reasons are as follows: All analysis operations are completed through intuitive controls, such as drop-down selection of groups and algorithms, sliding adjustment of thresholds, and one-click triggering of analysis, with zero code input, greatly reducing the cognitive load of interaction; Based on `reactiveValues`, a dynamic dependency graph is constructed. After any parameter (such as log2FC threshold, P-value truncation, species selection) changes, the system automatically identifies the scope of impact and only recalculates the necessary modules, ensuring that the analysis link is efficient, accurate, and without redundancy; All charts are encapsulated as `plotly` objects, natively supporting zooming, panning, and hovering to view multi-dimensional information such as gene names / P-values / cell annotations, and can directly export high-definition static charts, without the need to write any plotting code throughout the process.
[0462] (2) Significantly improve analysis efficiency: Through batch processing, parallel computing and fully automated workflow, the time spent on multiple differences comparison and enrichment analysis is reduced from tens of minutes to several minutes, and the overall efficiency is improved by more than 10 times. The reasons are as follows: Calling `FindAllMarkers()` completes the full matrix calculation for pairwise comparisons of all cell groups in one go, avoiding repeated calls to `FindMarkers()` and redundant data loading, significantly reducing the overhead of Seurat's underlying object parsing and memory copying; Based on the `future` framework, it enables 4-core multi-process parallelism, simultaneously executing independent tasks such as up- / down-adjustment of GO enrichment and KEGG pathway enrichment, making full use of CPU resources and reducing overall enrichment time by approximately 75%; All analysis relies on a local pre-built database (annotation library, GMT pathway files), with no external HTTP requests throughout the process, completely avoiding risks such as network timeouts, API rate limiting, and service unavailability; The `openxlsx` package enables atomic writing of multiple Excel worksheets (GO_Up / GO_Down / KEGG), automatically unifying fonts, column widths, numerical formats, and header styles, ensuring professional and standardized exported files.
[0463] (3) Ensuring stable and reproducible results: All analyses are performed based on an offline local database, eliminating network dependencies and locking the database version to ensure that the same data outputs completely consistent results in different time and space environments. The reasons are as follows: By constructing a local GMT format gene set resource covering 8 major functional databases such as GO, KEGG, and Reactome, and using the built-in hypergeometric test algorithm to achieve full-link offline enrichment analysis, the results are ensured to be stable and reproducible.
[0464] (4) Enhanced interactive data exploration capabilities: Interactive charts support functions such as zooming, panning, hovering to view cell details, and selecting subsets for in-depth analysis, significantly improving the efficiency and depth of data insights. The reason is as follows: Relying on Shiny's `reactiveValues` responsive state management and `observeEvent` event-driven mechanism, coupled with `plotly` interactive charts, it achieves millisecond-level linkage response between parameter adjustment, chart redrawing, and cell selection.
[0465] (5) Completely eliminate species identification errors: Automatic species identification is achieved through dual matching of gene naming features and feature gene database, and corresponding resources are dynamically loaded, reducing the analysis error rate caused by database mismatch from 37% to 0. The reason is as follows: Through the triple criteria of gene naming rules, feature gene distribution and database matching degree, the species (human / mouse) of input data is automatically and accurately identified, effectively avoiding annotation errors and enrichment failures caused by misclassification of species.
[0466] Based on the foregoing embodiments, this invention provides a web-based intelligent analysis method for single-cell RNA sequencing data. (See [link to relevant documentation]). Figure 3 The diagram shows a flowchart of a web-based intelligent analysis method for single-cell RNA sequencing data. This method mainly includes the following steps S302 to S308:
[0467] Step S302: Receive cell populations via a web interface. The cell populations include at least two single-cell RNA sequencing data to be compared.
[0468] Step S304: Perform differential gene analysis on the single-cell RNA sequencing data contained in the cell population to obtain an original differential gene list. Use a multi-threshold screening algorithm to filter the original differential gene list to obtain a target differential gene list. The multi-threshold screening algorithm includes at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold.
[0469] Step S306: Perform automatic species identification processing on the target differential gene list, call the target local gene set database based on the result of the automatic species identification processing, and perform parallel enrichment analysis on the target differential gene list without network connection based on the target local gene set database to obtain gene enrichment analysis results.
[0470] Step S308: Using an intelligent tagging anti-overlap algorithm, generate a list of target differentially expressed genes and / or an interactive chart corresponding to the gene enrichment analysis results to visualize the interactive chart.
[0471] The web-based intelligent analysis method for single-cell RNA sequencing data provided in this invention receives multi-group data through a web interface, significantly reducing the operational threshold for biomedical researchers. By introducing a triple threshold screening based on statistical significance, fold change in expression, and difference in expression ratio, it accurately removes low-expression noise genes, improving the biological reliability of differentially expressed marker genes. By automatically identifying species and matching them to a local database, it completely avoids human mismatching and network dependence. The use of a parallel computing framework to execute multiple enrichment tasks simultaneously can significantly improve the analysis results. Finally, through an intelligent labeling anti-overlap algorithm, it uniformly optimizes the text annotation of differential gene scatter plots and enrichment entry bar charts, greatly improving the readability of charts and the depth of interactive exploration.
[0472] The method provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned system embodiment. For the sake of brevity, any part not mentioned in the method embodiment can be referred to the corresponding content in the aforementioned system embodiment.
[0473] This invention provides an electronic device, specifically, the electronic device includes a processor and a memory; the memory stores a computer program, which, when run by the processor, executes the method described in any of the above embodiments.
[0474] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 100, which includes a processor 40, a memory 41, a bus 42 and a communication interface 43. The processor 40, the communication interface 43 and the memory 41 are connected through the bus 42. The processor 40 is used to execute executable modules, such as computer programs, stored in the memory 41.
[0475] The memory 41 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 43 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.
[0476] Bus 42 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0477] The memory 41 is used to store programs. After receiving an execution instruction, the processor 40 executes the program. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 40 or implemented by the processor 40.
[0478] Processor 40 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 40 or by instructions in software form. Processor 40 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 41. The processor 40 reads the information in memory 41 and, in conjunction with its hardware, completes the steps of the above method.
[0479] The computer program product of the readable storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, please refer to the foregoing method embodiments, which will not be repeated here.
[0480] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0481] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A Web-based intelligent analysis system for single-cell RNA sequencing data, characterized in that, include: The user interaction module is used to receive cell groups via a web interface, the cell groups including at least two single-cell RNA sequencing data to be compared; The intelligent anomaly analysis module is used to perform differential gene analysis on the single-cell RNA sequencing data contained in the cell group to obtain an original differential gene list, and to filter the original differential gene list using a multi-threshold screening algorithm to obtain a target differential gene list; wherein, the multi-threshold screening algorithm includes at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold; The offline enrichment analysis module is used to perform automatic species identification processing on the target differential gene list, call the target local gene set database based on the result of the automatic species identification processing, and perform parallel enrichment analysis on the target differential gene list without network connection based on the target local gene set database to obtain gene enrichment analysis results. The visualization output module is used to generate the target differential gene list and / or the interactive chart corresponding to the gene enrichment analysis results using an intelligent label anti-overlap algorithm, so as to visualize the interactive chart; An intelligent tagging anti-overlap algorithm is used to generate the target differentially expressed gene list and / or interactive charts corresponding to the gene enrichment analysis results, including: The following operations are performed on the target differentially expressed gene list: Based on the fold change in expression of each gene in the target differentially expressed gene list, the list is divided into a second upregulated gene set and a second downregulated gene set; the genes in the second upregulated gene set are sorted in descending order according to their expression ratio differences, and a second upregulated gene set to be displayed is extracted from the second upregulated gene set based on the descending order; the genes in the second downregulated gene set are sorted in ascending order according to their expression ratio differences, and a second downregulated gene set to be displayed is extracted from the second downregulated gene set based on the ascending order. The following operations are performed on the gene enrichment analysis results: the enrichment fold corresponding to the gene enrichment analysis results is determined, the gene enrichment analysis results are sorted in descending order according to the enrichment fold, and the gene enrichment analysis results to be displayed are extracted from the gene enrichment analysis results based on the descending order. One or more of the second upregulated gene set to be displayed, the second downregulated gene set to be displayed, and the gene enrichment analysis results to be displayed are used as the data to be displayed; An intelligent label anti-overlap algorithm is used to generate an interactive chart corresponding to the data to be displayed.
2. The Web-based intelligent analysis system for single-cell RNA sequencing data according to claim 1, characterized in that, A multi-threshold filtering algorithm is used to filter the original differentially expressed gene list to obtain a target differentially expressed gene list, including: Determine the statistical significance, fold change in expression, and difference in expression ratio for each gene in the original differentially expressed gene list; Determine whether the statistical significance is less than the statistical significance threshold, whether the change in expression fold is greater than the change in expression fold threshold, and whether the difference in expression ratio is greater than the difference in expression ratio threshold; If any judgment result is negative, the gene is removed from the original differential gene list to obtain the target differential gene list.
3. The Web-based intelligent analysis system for single-cell RNA sequencing data according to claim 1, characterized in that, The target differential gene list is subjected to automatic species identification processing, including: Extract the name features of the target differential gene list, and based on the name features and preset gene naming rules, make a preliminary determination of the species to which the target differential gene list belongs; If the initial determination fails, the target differential gene list is matched with a pre-stored multi-species characteristic gene library to determine the species to which the target differential gene list belongs based on the gene matching results.
4. The Web-based intelligent analysis system for single-cell RNA sequencing data according to claim 1, characterized in that, Based on the target local gene set database, a network-connection-independent parallel enrichment analysis is performed on the target differentially expressed gene list to obtain gene enrichment analysis results, including: Based on the fold change in expression of each gene in the target differential gene list, the target differential gene list is divided into a first upregulated gene set and a first downregulated gene set; Based on the target local gene set database, offline parallel enrichment processing is performed on the first upregulated gene set and / or the first downregulated gene set to obtain the upregulated gene enrichment analysis results and / or the downregulated gene enrichment analysis results.
5. The Web-based intelligent analysis system for single-cell RNA sequencing data according to claim 1, characterized in that, An interactive chart corresponding to the data to be displayed is generated using an intelligent tag anti-overlap algorithm, including: A two-dimensional coordinate system chart is constructed with the change in expression fold as the horizontal axis and the difference in expression ratio as the vertical axis, and differential gene scatter points are plotted in the two-dimensional coordinate system chart; The anchor point's x-coordinate is determined based on the largest difference in the stated expression ratio; Based on the baseline position of the differential gene scatter points in the two-dimensional coordinate system chart and the preset label repulsion force, the horizontal coordinate of the anchor point is adaptively offset to add text labels of the differential gene scatter points at the offset horizontal coordinate of the anchor point, thereby obtaining an interactive chart corresponding to the data to be displayed. The content displayed in the text label includes at least the name information of the gene.
6. The Web-based intelligent analysis system for single-cell RNA sequencing data according to claim 1, characterized in that, The visualization output module is also used for: Obtain the gene attribute information to be queried, including the gene's location information on the UMAP map or the gene's name information; Based on the target differential gene list corresponding to the gene data information and the gene enrichment analysis results, generate multi-dimensional charts and / or statistical analysis charts; Receive parameter adjustment parameters for the multi-dimensional chart and the statistical analysis chart, and update the multi-dimensional chart and the statistical analysis chart in real time.
7. A Web-based intelligent analysis method for single-cell RNA sequencing data, characterized in that, include: Receive cell groups via a web interface, the cell groups comprising at least two single-cell RNA sequencing data to be compared; Differential gene analysis is performed on the single-cell RNA sequencing data contained in the cell group to obtain an original differential gene list. A multi-threshold screening algorithm is then used to filter the original differential gene list to obtain a target differential gene list. The multi-threshold screening algorithm includes at least a statistical significance threshold, an expression fold change threshold, and an expression ratio difference threshold. The target differential gene list is subjected to automatic species identification processing. Based on the results of the automatic species identification processing, the target local gene set database is called. The target differential gene list is subjected to parallel enrichment analysis without network connection based on the target local gene set database to obtain gene enrichment analysis results. An intelligent tagging anti-overlap algorithm is used to generate the target differential gene list and / or the interactive chart corresponding to the gene enrichment analysis results, so as to visualize the interactive chart; An intelligent tagging anti-overlap algorithm is used to generate the target differentially expressed gene list and / or interactive charts corresponding to the gene enrichment analysis results, including: The following operations are performed on the target differentially expressed gene list: Based on the fold change in expression of each gene in the target differentially expressed gene list, the list is divided into a second upregulated gene set and a second downregulated gene set; the genes in the second upregulated gene set are sorted in descending order according to their expression ratio differences, and a second upregulated gene set to be displayed is extracted from the second upregulated gene set based on the descending order; the genes in the second downregulated gene set are sorted in ascending order according to their expression ratio differences, and a second downregulated gene set to be displayed is extracted from the second downregulated gene set based on the ascending order. The following operations are performed on the gene enrichment analysis results: the enrichment fold corresponding to the gene enrichment analysis results is determined, the gene enrichment analysis results are sorted in descending order according to the enrichment fold, and the gene enrichment analysis results to be displayed are extracted from the gene enrichment analysis results based on the descending order. One or more of the second upregulated gene set to be displayed, the second downregulated gene set to be displayed, and the gene enrichment analysis results to be displayed are used as the data to be displayed; An intelligent label anti-overlap algorithm is used to generate an interactive chart corresponding to the data to be displayed.
8. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the method of claim 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the method of claim 7.
Citation Information
Patent Citations
Interactive analysis system and method for transcriptome project with reference genome based on cloud computing platform
CN109086567A
Bioinformatics systems, apparatus, and methods for performing secondary and / or tertiary processing
CN109416928A