A spatial transcriptome lightweight analysis method and system based on physical prior

CN122930199APending Publication Date: 2026-10-16SICHUAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611093746.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0003]但是,在多切片、高分辨率或细胞密度分布不均匀的空间转录组数据中,若直接基于空间坐标对大量细胞进行邻近关系搜索或源靶关系分析,容易产生数量庞大的候选细胞组合

Benefits of technology

[0009] 1. This invention generates a radius-adjacent grid mapping relationship and reduces the index granularity under the corresponding radius number when the candidate retrieval load value is above the load threshold. This allows the high-load region to form an adjacent grid range adapted to the candidate retrieval load, thereby reducing the candidate relationship search load and expression matrix analysis computation while maintaining the effectiveness of physical interaction distance constraints. This effectively solves the problem of low transcriptional analysis efficiency caused by the need for a large number of neighbor relationship searches and full cell pair traversal in large-scale spatial transcriptome source-target relationship analysis in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122930199A_ABST
    Figure CN122930199A_ABST
Patent Text Reader

Abstract

The application discloses a physical-prior-based spatial transcriptome lightweight analysis method and system, relates to the technical field of data processing, and comprises the following steps: acquiring spatial transcriptome basic data and generating a slice space index, combining a preset physical action distance to generate a physical action radius segmentation configuration, generating a slice space grid based on an index granularity, generating a radius adjacent grid mapping relationship, reading a target cell set to generate each candidate source target pair, and screening to obtain a candidate source target pair sparse index, and then generating an effective source target pair lightweight analysis result. The application reduces the full-amount cell pair traversal and expression matrix reading amount, and improves the spatial transcriptome source target relationship analysis efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, specifically to a lightweight spatial transcriptome analysis method and system based on physical priors. Background Technology

[0002] Current spatial transcriptome data analysis typically focuses on sequencing sites or cells within tissue sections. It combines spatial coordinates, expression matrices, and cell type annotations to construct spatial proximity or cell relationship networks, and analyzes the spatial distribution characteristics, expression correlations, and potential interactions among different cell populations. Existing methods usually determine proximity based on the spatial distance between cells or sequencing sites, and then combine this with expression matrix data for subsequent statistical or correlation analysis.

[0003] However, in spatial transcriptome data with multiple slices, high resolution, or uneven cell density distribution, directly performing neighborhood search or source-target relationship analysis on a large number of cells based on spatial coordinates can easily generate a huge number of candidate cell combinations. Especially in densely populated local cell regions, a uniform neighborhood search method will cause a large number of invalid candidate relationships to enter the subsequent expression calculation process, leading to an increase in distance judgments, frequent expression matrix reads, increased storage overhead, and reduced overall analysis efficiency. Therefore, existing technologies face the technical challenge of reducing the candidate relationship search load and expression analysis computational load while maintaining the effectiveness of spatial physical constraints when performing source-target relationship analysis of large-scale spatial transcriptomes. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a lightweight spatial transcriptome analysis method and system based on physical priors.

[0005] To achieve the above objectives, the technical solution of the present invention is as follows:

[0006] In a first aspect, this invention discloses a lightweight spatial transcriptome analysis method based on physical priors, comprising the following steps: acquiring basic spatial transcriptome data, including slice number, spatial coordinates, cell type labels, and expression matrix index; generating a slice spatial index based on slice number and spatial coordinates; acquiring a preset physical interaction distance and generating a physical interaction radius segmentation configuration based on the slice spatial index, the physical interaction radius segmentation configuration including radius number, radius distance range, and index granularity; dividing the spatial region corresponding to each slice number into a grid based on the index granularity and the slice spatial index, generating a slice spatial grid; and determining the adjacent grid range corresponding to each physical interaction radius segment based on the radius distance range and the slice spatial grid. The process involves associating the radius number, adjacent grid range, and grid cell number of the slice spatial grid corresponding to each physical radius segment to generate a radius-adjacent grid mapping relationship. Based on cell type labels, the source cell set is determined, and based on the grid cell number of each source cell in the source cell set, the target cell set within the corresponding adjacent grid range is read from the radius-adjacent grid mapping relationship to generate candidate source-target pairs. Based on slice number, radius distance range, spatial coordinates, cell type labels, and expression matrix index, each candidate source-target pair is screened to obtain a sparse index of candidate source-target pairs. This sparse index records the candidate correspondence between source cells and target cells. Finally, a lightweight analysis result of effective source-target pairs is generated based on the sparse index of candidate source-target pairs.

[0007] Secondly, this invention discloses a lightweight spatial transcriptome analysis system based on physical priors, comprising the following modules: a basic data index module, used to acquire basic spatial transcriptome data, including slice number, spatial coordinates, cell type labels, and expression matrix index, and to generate a slice spatial index based on slice number and spatial coordinates; a radius segmentation configuration module, used to acquire a preset physical interaction distance and generate a physical interaction radius segmentation configuration based on the slice spatial index; a spatial grid generation module, used to perform grid division on the spatial region corresponding to each slice number based on the index granularity and the slice spatial index, generating a slice spatial grid; and an adjacency mapping generation module, used to determine the adjacency grid range corresponding to each physical interaction radius segment based on the radius distance range and the slice spatial grid, and to map each physical interaction... The system associates the radius number, adjacent grid range, and grid cell number of the slice spatial grid corresponding to the radius segment to generate a radius-adjacent grid mapping relationship. The source-target pair generation module determines the source cell set based on cell type labels and reads the target cell set within the corresponding adjacent grid range from the radius-adjacent grid mapping relationship based on the grid cell number of each source cell in the source cell set, generating candidate source-target pairs. The sparse index generation module filters each candidate source-target pair based on slice number, radius distance range, spatial coordinates, cell type label, and expression matrix index to obtain a candidate source-target pair sparse index, which records the candidate correspondence between source cells and target cells. The lightweight analysis module generates effective source-target pair lightweight analysis results based on the candidate source-target pair sparse index.

[0008] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0009] 1. This invention generates a radius-adjacent grid mapping relationship and reduces the index granularity under the corresponding radius number when the candidate retrieval load value is above the load threshold. This allows the high-load region to form an adjacent grid range adapted to the candidate retrieval load, thereby reducing the candidate relationship search load and expression matrix analysis computation while maintaining the effectiveness of physical interaction distance constraints. This effectively solves the problem of low transcriptional analysis efficiency caused by the need for a large number of neighbor relationship searches and full cell pair traversal in large-scale spatial transcriptome source-target relationship analysis in the prior art.

[0010] 2. This invention generates a slice spatial index based on slice number and spatial coordinate analysis, and generates a slice spatial grid based on index granularity and slice spatial index, thereby transforming continuous spatial coordinates in the basic spatial transcriptome data into searchable grid unit numbers. This enables group management and gridded reading of spatial data under different slice numbers, reducing repeated traversal of the original spatial coordinates.

[0011] 3. This invention reads the target cell set within the corresponding adjacent grid range from the radius adjacent grid mapping relationship based on the grid cell number where each source cell in the source cell set is located. This limits the candidate source-target pair generation process to the local spatial region corresponding to the radius number and the adjacent grid range, thereby achieving localized generation of candidate source-target pairs and reducing irrelevant cell combinations entering the subsequent screening process. Attached Figure Description

[0012] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts. Wherein:

[0013] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention.

[0014] Figure 2 A flowchart for generating the radius adjacency grid mapping relationship of the present invention;

[0015] Figure 3 This is a flowchart illustrating the generation of candidate source-target pairs and the generation of effective source-target pair lightweight analysis results in this invention.

[0016] Figure 4 This is a system structure diagram of the present invention. Detailed Implementation

[0017] It is readily understood that, based on the technical solution of this invention, those skilled in the art can propose various interchangeable structural methods and implementations without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of this invention.

[0018] This invention uses spatial transcriptome data as the processing object, which includes slice number, spatial coordinates, cell type labels, and expression matrix index. A slice spatial index is generated based on the slice number and spatial coordinates, and a segmented configuration of physical interaction radius is generated in conjunction with a preset physical interaction distance, enabling subsequent analysis to be segmented according to different physical interaction ranges. Then, based on the index granularity, the spatial region corresponding to each slice number is divided into a grid, generating a slice spatial grid, and a radius adjacency grid mapping relationship is generated based on the radius distance range and the slice spatial grid.

[0019] The core improvement of this application lies in addressing the uneven cell distribution and excessively large number of candidate relationships in local high-density regions of spatial transcriptome data. It estimates the candidate retrieval load based on the number of grid cells and the radius distance range. When the candidate retrieval load is high, the index granularity under the corresponding radius number is reduced to generate a finer adjacency grid range; when the candidate retrieval load is low, the current index granularity is maintained to generate a normal adjacency grid range. Thus, the adjacency search range is dynamically determined according to the data load status of different grid regions, avoiding a uniform granularity neighbor search for all cells.

[0020] Based on this, the scheme determines the source cell set based on cell type labels, and reads the target cell set within the corresponding adjacent grid range from the radius adjacent grid mapping relationship according to the grid cell number where the source cells are located, generating candidate source-target pairs; then, it combines slice number, radius distance range, spatial coordinates, cell type labels and expression matrix index for screening to obtain a sparse index of candidate source-target pairs; based on the sparse index of candidate source-target pairs, it reads the expression matrix data and calculates the expression correlation value to generate the lightweight analysis results of effective source-target pairs.

[0021] Through the above-mentioned technical means, this application can transform the spatial transcriptome source-target relationship analysis from a full cell pair traversal to a local candidate relationship analysis based on physical constraints and load regulation, thereby reducing the number of invalid candidate source-target pairs, reducing the number of spatial distance judgments and expression matrix reads, and improving the processing efficiency and resource utilization of large-scale spatial transcriptome data analysis.

[0022] This invention provides a lightweight spatial transcriptome analysis method based on physical priors, comprising the following steps: acquiring basic spatial transcriptome data, including slice number, spatial coordinates, cell type labels, and expression matrix index; generating a slice spatial index based on slice number and spatial coordinates; acquiring a preset physical interaction distance and generating a physical interaction radius segmentation configuration based on the slice spatial index, the physical interaction radius segmentation configuration including radius number, radius distance range, and index granularity; dividing the spatial region corresponding to each slice number into a grid based on the index granularity and the slice spatial index, generating a slice spatial grid; determining the adjacent grid range corresponding to each physical interaction radius segment based on the radius distance range and the slice spatial grid, and then... The radius number, adjacent grid range, and grid cell number of the slice spatial grid corresponding to each physical action radius segment are associated to generate a radius-adjacent grid mapping relationship. The source cell set is determined based on the cell type label, and the target cell set within the corresponding adjacent grid range is read from the radius-adjacent grid mapping relationship based on the grid cell number of each source cell in the source cell set to generate candidate source-target pairs. The candidate source-target pairs are screened based on the slice number, radius distance range, spatial coordinates, cell type label, and expression matrix index to obtain a sparse index of candidate source-target pairs. The sparse index of candidate source-target pairs is used to record the candidate correspondence between source cells and target cells. The effective source-target pair lightweight analysis results are generated based on the sparse index of candidate source-target pairs.

[0023] In this embodiment, as Figure 1 As shown, Figure 1 The following is a flowchart of the overall process of the present invention. The specific process is as follows: acquire basic spatial transcriptome data and generate a slice spatial index; generate a segmented configuration of physical action radius based on the slice spatial index; generate a slice spatial grid based on the index granularity; generate a radius adjacency grid mapping relationship based on the radius distance range and the slice spatial grid; read the target cell set within the adjacency grid range to generate each candidate source-target pair; screen to obtain a sparse index of candidate source-target pairs; and generate a lightweight analysis result of effective source-target pairs based on the sparse index of candidate source-target pairs.

[0024] Furthermore, a spatial index of slices is generated based on slice number and spatial coordinate analysis. Specifically, this includes: grouping the basic spatial transcriptome data according to the slice number to obtain the slice data group corresponding to each slice; performing coordinate encoding processing on the spatial coordinates in each slice data group with a predetermined number of bits to obtain the spatial coordinate code; and associating the slice number, spatial coordinate code, cell type label, and expression matrix index in the same slice data group to generate a spatial index of slices.

[0025] In this embodiment, a slice data group refers to a set of basic spatial transcriptome data records grouped according to the same slice number. The slice number can be read from the sample information table exported by the spatial transcriptome analysis software.

[0026] The predetermined number of decimal places refers to the number of decimal places retained before coordinate encoding of spatial coordinates. The predetermined number of decimal places can be determined based on the source of the spatial coordinates: when the spatial coordinates come from image pixel coordinates, the predetermined number of decimal places can be 0; when the spatial coordinates come from physical coordinates after microscopic imaging calibration, the predetermined number of decimal places can be determined based on the coordinate precision of the microscope calibration file. Specifically, during acquisition, the processor reads the coordinate values ​​from the spatial coordinate file, counts the number of decimal places in the coordinate values, and combines this with the pre-set coordinate retention precision to determine the predetermined number of decimal places.

[0027] Spatial coordinate encoding refers to converting spatial coordinates into integer coordinate identifiers that can be used for index matching by specifying a predetermined number of bits. Spatial coordinates can be obtained by reading the tissue coordinate table in the object. The expression matrix index can be determined by the cell barcodes in the expression matrix, and the cell type labels can be written by the spatial transcriptome clustering annotation results.

[0028] A slice spatial index is a data index structure that uses slice number and spatial coordinate encoding as the primary retrieval criteria, and associates cell type labels and expression matrix indexes. Slice spatial indexes can be implemented using a two-dimensional index table. If multiple cells or sequencing sites exist under the same slice number and spatial coordinate encoding, the processor will associate multiple expression matrix indices in a list format under that slice number and spatial coordinate encoding, avoiding data overwriting during subsequent index construction.

[0029] Grouping spatial transcriptome data according to slice number isolates data from different tissue slices at the index level, preventing identical or similar spatial coordinates from being mistakenly identified as belonging to the same spatial region, thus improving the reliability of grid division and source-target pair generation. By encoding spatial coordinates with a predetermined number of decimal places, the precision of coordinates from different data sources or file formats is standardized, making the expression of spatial coordinates in the slice spatial index more stable and reducing duplicate indexing, retrieval bias, or unnecessary spatial coordinate comparisons caused by differences in decimal places. By associating slice number, spatial coordinate encoding, cell type label, and expression matrix index, the required data can be quickly retrieved from the same index structure during physical radius segmentation, slice spatial grid division, candidate source-target pair generation, and expression matrix retrieval, reducing redundant scanning of the original spatial transcriptome data and expression matrix.

[0030] Furthermore, the physical action radius is segmented and configured by combining the slice space index. Specifically, this includes: generating a preset number of radius distance ranges based on the preset physical action distance, and configuring a corresponding radius number for each radius distance range; determining the index granularity corresponding to each radius number based on each radius distance range and the preset granularity configuration rules; and associating the radius number, radius distance range, and index granularity to generate the physical action radius segmentation configuration.

[0031] In this embodiment, the preset physical interaction distance refers to the maximum spatial distance used to limit the possible spatial association or physical interaction between cells in spatial transcriptome analysis. This parameter can be pre-written into the processor through a configuration file. This distance uses the same unit as the spatial coordinates. If the spatial coordinates are pixel coordinates, the physical interaction distance is also in pixel units; if the spatial coordinates are micrometer coordinates, the physical interaction distance is also in micrometer units.

[0032] Index granularity refers to the mesh scale used when subsequently performing spatial mesh generation in the slice. The smaller the index granularity, the finer the mesh; the larger the index granularity, the coarser the mesh.

[0033] How the radius distance range is generated:

[0034] ;

[0035] ;

[0036] ;

[0037] In the formula, Indicates the first The lower limit of the radius distance range corresponding to each radius number. Indicates the physical distance of action. Indicates the preset quantity. Indicates the sorting sequence number of the radius number. , This indicates the total number of radius numbers. Indicates the first The upper limit of the radius distance range corresponding to each radius number. Indicates the first The radius distance range corresponding to each radius number

[0038] Specifically, the smaller the radius number in the sequence, the larger the upper limit of the corresponding radius distance range; conversely, the larger the radius number in the sequence, the smaller the upper limit of the corresponding radius distance range. The larger the preset physical action distance, the larger the overall upper and lower limits of each radius distance range; the larger the preset number, the smaller the span of each radius distance range, and the finer the radius segmentation.

[0039] How to determine index granularity:

[0040] ;

[0041] In the formula, Indicates the first The index granularity corresponding to each radius number. Indicates the smallest index granularity. Indicates the first The upper limit of the radius distance range corresponding to each radius number. This represents the preset granularity segmentation coefficient.

[0042] A larger upper limit for the radius distance range corresponds to a larger index granularity, resulting in a coarser subsequent mesh division and reducing the number of meshes at long distances. Conversely, a smaller upper limit for the radius distance range corresponds to a smaller index granularity, resulting in a finer subsequent mesh division and improving spatial positioning accuracy at short distances. A larger preset granularity division coefficient corresponds to a smaller index granularity; the minimum index granularity is used to avoid an excessive number of meshes due to overly small index granularity. The radius numbers are configured in descending order according to the upper limit of the radius distance range.

[0043] By dividing the preset physical interaction distance into multiple radius distance ranges and configuring corresponding radius numbers and index granularities for each radius distance range, spatial transcriptome analysis can be segmented according to different physical interaction scales, rather than using a single fixed radius for uniform neighborhood search. For larger radius distance ranges, configuring relatively larger index granularities can reduce the number of grids generated during long-distance retrieval and reduce the burden of constructing adjacent grid ranges; for smaller radius distance ranges, configuring relatively smaller index granularities can improve the spatial accuracy of screening for near-range source-target relationships and reduce the risk of near-range physical interaction relationships being obscured by coarse-grained grids. The radius numbers are configured from largest to smallest according to the upper limit of the radius distance range, which also allows subsequent processors to read different radius segments in a fixed order, facilitating the unified storage and retrieval of radius-adjacent grid mapping relationships. Therefore, the overall scheme provides a segmented physical constraint basis for the generation of slice spatial grids, the generation of radius-adjacent grid mapping relationships, and the generation of sparse indexes for candidate source-target pairs, which helps to reduce the computational burden of subsequent source-target pair analysis while maintaining the effectiveness of spatial physical constraints.

[0044] Furthermore, generating a sliced ​​spatial grid specifically includes: reading the spatial coordinates corresponding to each slice based on the sliced ​​spatial index, and determining the coordinate coverage area corresponding to each slice; dividing the coordinate coverage area into grids based on the index granularity to obtain multiple grid cells; configuring a grid cell number for each grid cell, and associating the grid cell number with the spatial coordinates falling into the corresponding grid cell and the expression matrix index to generate a sliced ​​spatial grid.

[0045] In this embodiment, the coordinate coverage area refers to the range covered by all spatial coordinates corresponding to a certain slice number in both the horizontal and vertical directions. This area can be obtained by the processor reading all spatial coordinates under the same slice number from the slice spatial index and calculating the minimum, maximum, minimum, and maximum values ​​of the horizontal and vertical coordinates, respectively.

[0046] A grid cell is a spatial sub-region obtained by dividing the coordinate coverage area according to the index granularity. Each grid cell corresponds to a range of horizontal coordinates and a range of vertical coordinates, which is used to assign spatial coordinates to the corresponding location region.

[0047] Grid cell number refers to the data number used to identify grid cells. The grid cell number can be generated jointly from the slice number, radius number, horizontal grid number, and vertical grid number. This avoids confusion between grid cell numbers under different slices or different radius numbers. The index granularity physical radius is configured and read segmented. When generating the slice spatial grid, the coordinate coverage area is meshed according to the index granularity corresponding to the current radius number.

[0048] The method for determining the coordinate coverage area is as follows: All spatial coordinates corresponding to the same slice number are read from the slice spatial index, and the boundary values ​​of the x and y coordinates are calculated, as shown below:

[0049] ;

[0050] ;

[0051] ;

[0052] ;

[0053] In the formula, Indicates the first The minimum x-coordinate corresponding to each slice number Indicates the first The x-coordinate of each data record Indicates the first The set of data records corresponding to each slice number Indicates the first The maximum x-coordinate corresponding to each slice number Indicates the first The minimum value of the ordinate corresponding to each slice number. Indicates the first The maximum value of the ordinate corresponding to each slice number.

[0054] The larger the difference between the maximum and minimum values ​​of the x-coordinate, the larger the horizontal spatial coverage corresponding to that slice number; similarly, the larger the difference between the maximum and minimum values ​​of the y-coordinate, the larger the vertical spatial coverage corresponding to that slice number. With the index granularity unchanged, a larger coordinate coverage area results in a greater number of grid cells.

[0055] The grid is divided into multiple grid cells. Specifically, the coordinate coverage area is divided into grids according to the index granularity, and the number of horizontal and vertical grids is calculated respectively.

[0056] ;

[0057] ;

[0058] In the formula, Indicates the first The slice number is in the... Each radius number corresponds to the number of horizontal grid cells at the index granularity. Indicates the first The maximum x-coordinate corresponding to each slice number Indicates the first The minimum x-coordinate corresponding to each slice number Indicates the first The index granularity corresponding to each radius number. This represents the floor function. Indicates the first The slice number is in the... Each radius number corresponds to the number of vertical grid cells at the index granularity. Indicates the first The maximum value of the y-coordinate corresponding to each slice number. Indicates the first The minimum value of the ordinate corresponding to each slice number.

[0059] The larger the horizontal spatial coverage, the larger the number of horizontal grids; the larger the vertical spatial coverage, the larger the number of vertical grids; the larger the index granularity, the smaller the number of horizontal and vertical grids; the smaller the index granularity, the larger the number of horizontal and vertical grids.

[0060] The specific steps for generating a sliced ​​spatial grid include: after obtaining the number of grid cells, assigning each spatial coordinate to its corresponding grid cell. Specifically, based on the position of the spatial coordinate relative to the starting point of the coordinate coverage area, the horizontal and vertical grid numbers are calculated. The farther the spatial coordinate is from the starting point of the coordinate coverage area, the larger the corresponding horizontal or vertical grid number; the larger the index granularity, the slower the change in the grid number corresponding to the same coordinate; the smaller the index granularity, the faster the change in the grid number corresponding to the same coordinate, resulting in finer spatial subdivision.

[0061] ;

[0062] ;

[0063] In the formula, Indicates the first The first data record Each radius number corresponds to a horizontal grid number at the index granularity. Indicates the first The x-coordinate of each data record Indicates the first The minimum x-coordinate corresponding to each slice number Indicates the first The index granularity corresponding to each radius number. This represents the floor function. Indicates the first The first data record Each radius number corresponds to a vertical grid number at the index granularity. Indicates the first The vertical axis of each data record Indicates the first The minimum value of the ordinate corresponding to each slice number.

[0064] The grid cell number can be composed of the slice number, radius number, horizontal grid number, and vertical grid number.

[0065] ;

[0066] In the formula, Indicates the first The first data record Each radius number corresponds to a grid cell number at the index granularity. Indicates the first The slice number to which each data record belongs. Indicates the sorting sequence number of the radius number. Indicates the horizontal grid number. Indicates the vertical grid number.

[0067] The grid cell number is associated with the spatial coordinates and expression matrix index of the cell falling within that grid cell. Therefore, when reading the target cell set within a specific grid cell, the grid cell number can be read first, and then the spatial coordinates and expression matrix index of the cell falling within that grid cell can be directly obtained, avoiding the need to traverse all spatial coordinates one by one.

[0068] By reading the spatial coordinates of each slice from the slice spatial index and determining the coordinate coverage area, the spatial regions corresponding to different slice numbers can be gridded separately, avoiding the mixing of spatial coordinates between different tissue slices. By gridding the coordinate coverage area based on index granularity, continuous spatial coordinates can be converted into discrete grid cell numbers, allowing the radius-adjacent grid mapping relationship to be established at the grid level, without directly determining pairwise distances for all cells or sequencing sites. By associating grid cell numbers with the spatial coordinates falling into the corresponding grid cell and the expression matrix index, the reading of source and target cells can be transformed from full data scanning to retrieval by grid cell number. This reduces the number of spatial coordinate traversals and the cost of expression matrix localization during candidate source-target pair generation. Furthermore, it allows for the construction of adjacency grid ranges of different granularities based on different radius numbers and index granularities, thus forming a searchable, segmentable, and reusable spatial data structure.

[0069] Furthermore, the generation of radius-adjacent grid mapping relationships specifically includes: calculating the number of cells corresponding to each grid cell number based on the sliced ​​spatial grid to obtain the number of grid cells; performing candidate retrieval load estimation processing based on the radius distance range corresponding to each physical action radius segment and the number of grid cells to obtain the candidate retrieval load value of each grid cell number under the corresponding radius number; obtaining a preset load threshold and comparing it with the candidate retrieval load value; if the candidate retrieval load value is above the load threshold, matching the candidate retrieval load value with a preset load granularity adjustment rule to obtain an index granularity adjustment value; reducing the index granularity under the corresponding radius number based on the index granularity adjustment value to obtain the target index granularity; if the candidate retrieval load value is less than the load threshold, using the index granularity under the current corresponding radius number as the target index granularity; performing adjacency range determination processing based on the target index granularity to obtain the adjacency grid range of the grid cell number corresponding to the current radius number; associating the radius number, grid cell number, candidate retrieval load value, target index granularity, and adjacency grid range to generate a radius-adjacent grid mapping relationship.

[0070] In this embodiment, as Figure 2 As shown, Figure 2 The flowchart for generating the radius adjacency grid mapping relationship of the present invention is as follows: Based on the number of grid cells in the slice space grid, candidate retrieval load values ​​are obtained by combining the radius distance range; the candidate retrieval load values ​​are compared with the load threshold; when the candidate retrieval load value is above the load threshold, an index granularity adjustment value is obtained and the index granularity is reduced; when the candidate retrieval load value is less than the load threshold, the current index granularity is maintained; the adjacency grid range is determined based on the target index granularity, and a radius adjacency grid mapping relationship is generated accordingly.

[0071] The number of cells in a grid refers to the number of cells or sequencing sites corresponding to each grid cell number in the slice space grid. The number of expression matrix indices associated with each grid cell number can be read from the slice space grid, and this number can be used as the number of cells in the corresponding grid cell number.

[0072] The specific method for obtaining the candidate retrieval load value of each grid cell number under the corresponding radius number is as follows:

[0073] ;

[0074] When the candidate retrieval load value is above the load threshold, i.e., the load ratio is greater than or equal to one, the processor calculates the index granularity adjustment value based on the current index granularity and the load ratio:

[0075] ;

[0076] ;

[0077] In the formula, Indicates the grid cell number In radius number The load ratio under, Indicates the grid cell number In radius number Candidate retrieval load values ​​below Indicates the load threshold. Indicates the grid cell number In radius number The index granularity adjustment value below, Indicates radius number The corresponding current index granularity, Indicates the grid cell number In radius number The target index granularity is as follows. This indicates the smallest index granularity.

[0078] The higher the candidate retrieval load value, the higher the load ratio; the higher the load threshold, the lower the load ratio obtained under the same candidate retrieval load value. The higher the load ratio, the larger the index granularity adjustment value; the larger the current index granularity, the larger the index granularity adjustment value obtained under the same load ratio. Among them, reducing the current index granularity according to the index granularity adjustment value and setting a minimum index granularity limit is to prevent the index granularity from being too small, resulting in too many subgrids.

[0079] When the candidate retrieval load value is less than the load threshold, it means that the candidate retrieval burden of the current grid cell number under the corresponding radius number has not reached the level that needs to be refined. At this time, the index granularity is not reduced, and the current index granularity is directly used as the target index granularity.

[0080] The adjacent grid range is obtained as follows: After obtaining the target index granularity, using the current grid cell number as the center, read the grid cells to be compared under the target index granularity and calculate the Euclidean distance between the center point of the current grid cell and the center point of the grid cell to be compared. To avoid omitting grid cells located at the boundary, grid cells to be compared whose center point distance does not exceed the sum of the upper limit of the radius distance range and the grid safety compensation distance are included in the adjacent grid range. The grid safety compensation distance uses the diagonal length of the grid cell corresponding to the target index granularity to prevent omitting grids intersecting at the boundary when relying solely on the center point distance. Specifically:

[0081] ;

[0082] In the formula, Indicates the grid cell number In radius number The adjacent grid range below, Indicates the grid cell number to be compared. Indicates the grid cell number The center point and the grid cell number to be compared The Euclidean distance between the center points, Indicates radius number The upper limit of the corresponding radius distance range, Indicates the grid cell number In radius number The target index granularity.

[0083] The larger the upper limit of the radius distance range, the larger the adjacent grid range, the larger the target index granularity, the larger the grid safety compensation distance, and the larger the adjacent grid range included. The radius number, grid cell number, candidate retrieval load value, target index granularity, and adjacent grid range are associated and stored to form a radius-adjacent grid mapping relationship. Based on the grid cell number and radius number of the source cell, the corresponding adjacent grid range can be directly read without repeatedly traversing all spatial coordinates.

[0084] By statistically analyzing the number of grid cells corresponding to each grid cell number, the processor can perceive the density of cell distribution in different spatial regions, rather than using the same adjacency range generation method for all grid regions. By generating candidate retrieval load values ​​based on radius distance range and grid cell number, the processing burden of candidate source-target pairs that a particular grid cell might generate under a certain radius number can be estimated before actually reading the target cell set, thus identifying locally high-density regions in advance. By reducing the index granularity when the candidate retrieval load value reaches or exceeds the load threshold, high-load regions can be further subdivided, reducing the situation where a single grid cell associates too many target cells at once; while maintaining the current index granularity when the candidate retrieval load value is below the load threshold avoids unnecessary refinement of low-load regions, reducing additional grid management overhead. By writing the candidate retrieval load value, target index granularity, and adjacent grid range into the radius-adjacent grid mapping relationship, the adjacent range adapted to the load state can be directly read when generating candidate source-target pairs subsequently. By transforming local cell density differences in spatial transcriptome data into a basis for index granularity adjustment, the radius adjacency grid mapping relationship is no longer a simple superposition of fixed grids, but a lightweight retrieval structure that can be adapted to the data processing load. This helps reduce the expansion of the number of candidate source-target pairs in high-density regions and reduces the computational pressure of expression matrix reading and expression association analysis.

[0085] Furthermore, the generation of candidate retrieval load values ​​specifically includes: determining the initial adjacent grid set corresponding to the current grid cell number based on the radius distance range; reading the cell count corresponding to each grid cell number within the initial adjacent grid set from the grid cell count; summing the cell counts corresponding to each grid cell number within the initial adjacent grid set to obtain the candidate cell count; counting the number of cells within the current grid cell number that meet the preset source cell type conditions based on cell type labels to obtain the estimated source cell count; and analyzing the candidate cell count and the estimated source cell count to obtain the candidate retrieval load value. The candidate retrieval load value is used to characterize the data processing load of generating candidate source target pairs for the current grid cell number under the corresponding radius number.

[0086] In this embodiment, the initial adjacent grid set refers to the set of neighboring grid cells initially selected based on the radius distance range corresponding to the current radius number before the index granularity is reduced according to the candidate retrieval load value. The initial adjacent grid set can be obtained by reading the current grid cell number and the surrounding grid cell numbers to be compared in the sliced ​​spatial grid and filtering according to the upper limit of the radius distance range.

[0087] The candidate cell count refers to the sum of the cell counts corresponding to all grid cell numbers in the initial adjacent grid set. The candidate cell count can be obtained by reading the cell count corresponding to each grid cell number in the initial adjacent grid set from the grid cell count and summing them up.

[0088] The estimated source cell count refers to the number of cells within the current grid cell number that meet the preset source cell type conditions. These preset source cell type conditions can be pre-set in a configuration file, for example, specifying a particular type of immune cell, tumor cell, or stromal cell as the source cell type. The processor reads the cell type labels of each data record within the current grid cell number and counts the number of data records that meet the preset source cell type conditions to obtain the estimated source cell count.

[0089] The initial adjacent mesh set can be calculated using the Euclidean distance formula to determine the distance between the center point of the current mesh cell and the center point of the mesh cell to be compared, and is determined based on the upper limit of the radius distance range corresponding to the current radius number. To avoid omitting boundary meshes, a mesh safety compensation distance corresponding to the current index granularity is added, specifically:

[0090] ;

[0091] Indicates the grid cell number In radius number The initial set of adjacent meshes below, Indicates the grid cell number to be compared. , This indicates the total number of grid cell numbers to be compared. Indicates the grid cell number The center point and the grid cell number to be compared The Euclidean distance between the center points, Indicates radius number The upper limit of the corresponding radius distance range, Indicates radius number The corresponding current index granularity. The larger the upper limit of the radius distance range, the larger the initial adjacent grid set; the larger the current index granularity, the larger the safety compensation distance, and the larger the initial adjacent grid set.

[0092] Preset source cell type conditions refer to the pre-defined conditions used when selecting source cells based on cell type labels in spatial transcriptome basic data. Specifically, the pre-defined conditions are one or more cell type labels that are allowed as source cells, and these cell type labels should be consistent with the existing cell type labels in the spatial transcriptome basic data. During execution, the processor reads the cell type names pre-written in the configuration file and compares them with the cell type labels in each data record. When the cell type label of a data record matches the preset source cell type conditions, the cells corresponding to that data record are included in the estimated number of source cells. For example, in tumor microenvironment analysis, if it is necessary to analyze the spatial association effect of tumor cells on surrounding cells, the preset source cell type conditions can be set to "cell type label is tumor cells".

[0093] The candidate retrieval load value characterizes the data processing load for generating candidate source-target pairs at the current grid cell number and the corresponding radius number. With a fixed estimated number of source cells, a higher number of candidate cells results in more potential candidate combinations between source cells and target cells; similarly, a higher estimated number of source cells also results in more candidate combinations. Therefore, the candidate retrieval load value is generated by multiplying the number of candidate cells by the estimated number of source cells.

[0094] By first determining the initial adjacent grid set based on the radius distance range, and then counting the number of candidate cells within the initial adjacent grid set, the scale of target cells that may participate in pairing around the current grid cell number can be estimated before the actual generation of candidate source-target pairs. By counting the estimated number of source cells within the current grid cell number that meet the preset source cell type conditions, the scale of candidate cells within the spatial adjacency range can be combined with the actual scale of cells that may generate source-target relationship analysis within the current grid, rather than simply judging the load based on the number of adjacent grids. The candidate retrieval load value is jointly determined by the number of candidate cells and the estimated number of source cells, which can more closely reflect the actual computational burden when generating candidate source-target pairs: when the number of candidate cells is large but the number of source cells is small, the load will not be overestimated; when there are many source cells but few candidate cells in the adjacent range, the load will not be overestimated; only when both are large will the candidate retrieval load value increase significantly, so that the adjustment of the target index granularity is not a simple superposition of grids and radii, but an adaptation based on the source cell scale and the adjacent candidate cell scale of the current grid region, thereby improving the targeting of lightweight retrieval in high-density areas and reducing the generation of invalid candidate source-target pairs.

[0095] Furthermore, the adjacent grid range of the corresponding grid cell number under the current radius number is obtained. Specific steps include: if the candidate retrieval load value corresponding to the current grid cell number is above a preset load threshold, then the grid cell corresponding to the current grid cell number is divided into sub-grid cells according to the target index granularity to obtain each sub-grid cell number, and the spatial coordinates falling within the corresponding grid cell number are redistributed to the corresponding sub-grid cell number; the sub-adjacent grid range corresponding to each sub-grid cell number is determined based on the radius distance range corresponding to the current radius number; the current grid cell number, each sub-grid cell number, and each sub-adjacent grid range are associated to generate the refined adjacent grid range corresponding to the current grid cell number under the current radius number; if the candidate retrieval load value is less than a preset load threshold, grid matching is performed based on the target index granularity and the radius distance range corresponding to the current radius number to generate the ordinary adjacent grid range corresponding to the current grid cell number under the current radius number; the adjacent grid range includes the refined adjacent grid range and the ordinary adjacent grid range.

[0096] In this embodiment, the sub-grid cell number refers to the number generated when the processor further subdivides the grid cell corresponding to the current grid cell number according to the target index granularity under high load conditions. This number is used to distinguish multiple smaller regions further subdivided within the same grid cell. It is obtained as follows: the processor reads the spatial coordinate range corresponding to the current grid cell number, divides it horizontally and vertically according to the target index granularity, and then assigns a sub-grid cell number to each subdivided region.

[0097] The sub-adjacent grid range refers to the range of adjacent grid cells corresponding to a given sub-grid cell number under the current radius number. The processor can calculate the distance between the current sub-grid cell number and the sub-grid cell numbers to be compared under the same slice number and radius number based on the radius distance range corresponding to the current radius number, and use the sub-grid cell numbers to be compared that meet the conditions as the sub-adjacent grid range.

[0098] Refining the adjacent grid range refers to the adjacent grid range formed by associating the current grid cell number, the numbers of each sub-grid cell, and the ranges of each sub-adjacent grid under high load conditions. Its purpose is to prevent subsequent readings of the target cell set from directly reading the entire ordinary adjacent grid range; instead, it reads the corresponding sub-adjacent grid range based on the sub-grid cell number where the source cell is located.

[0099] The normal adjacent grid range refers to the adjacent grid range generated directly based on the target index granularity and radius distance range without subgrid division of the current grid cell number under low load conditions.

[0100] The specific implementation method of sub-mesh cell division:

[0101] ;

[0102] ;

[0103] In the formula, Indicates the current grid cell number The corresponding number of horizontal subgrids, Indicates the current grid cell number The corresponding horizontal endpoint coordinates, Indicates the current grid cell number The corresponding horizontal starting point coordinates, Indicates the current grid cell number The corresponding target index granularity, This represents the floor function. Indicates the current grid cell number The corresponding number of vertical subgrids, Indicates the current grid cell number The corresponding vertical endpoint coordinates, Indicates the current grid cell number The corresponding vertical starting point coordinates.

[0104] The greater the difference between the horizontal endpoint coordinates and the horizontal start coordinates, the more horizontal subgrids there are; the smaller the target index granularity, the more horizontal subgrids there are. The greater the difference between the vertical endpoint coordinates and the vertical start coordinates, the more vertical subgrids there are; the smaller the target index granularity, the more vertical subgrids there are.

[0105] The horizontal start coordinates, horizontal end coordinates, vertical start coordinates, and vertical end coordinates can be calculated from the grid cell number and index granularity in the sliced ​​spatial grid. Based on the horizontal and vertical arrangement positions corresponding to the grid cell number, combined with the starting point of the coordinate coverage area corresponding to the slice number and the original index granularity under the current radius number, the spatial boundary corresponding to the current grid cell number is determined.

[0106] The method for redistributing spatial coordinates to sub-grid cell numbers is as follows: After completing the sub-grid cell division, read the spatial coordinates that fall within the current grid cell number, and redistribute the spatial coordinates to the corresponding sub-grid cell numbers according to the position of the spatial coordinates relative to the spatial boundary corresponding to the current grid cell number.

[0107] ;

[0108] ;

[0109] ;

[0110] In the formula, Indicates the data record number The corresponding horizontal subgrid number, Indicates the current grid cell number The corresponding number of horizontal subgrids, Indicates the data record number The corresponding x-coordinate, Indicates the current grid cell number The corresponding horizontal starting point coordinates, Indicates the current grid cell number The corresponding target index granularity, This represents the floor function. Indicates the data record number The corresponding vertical subgrid number, Indicates the current grid cell number The corresponding number of vertical subgrids, Indicates the data record number The corresponding ordinate, Indicates the current grid cell number The corresponding vertical starting point coordinates, Indicates the data record number The corresponding subgrid cell number.

[0111] The farther the x-coordinate of the spatial coordinate is from the horizontal starting coordinate of the current grid cell number, the larger the horizontal subgrid number, the smaller the target index granularity, and the faster the horizontal subgrid number changes. The farther the y-coordinate of the spatial coordinate is from the vertical starting coordinate of the current grid cell number, the larger the vertical subgrid number, the smaller the target index granularity, and the faster the vertical subgrid number changes.

[0112] The sub-adjacent mesh range corresponding to each sub-mesh cell number is determined as follows: After generating each sub-mesh cell number, the sub-adjacent mesh range corresponding to each sub-mesh cell number is determined based on the radius distance range corresponding to the current radius number. The Euclidean distance between the center points of the current sub-mesh cell number and the sub-mesh cell number to be compared can be calculated. To avoid missing sub-mesh cells at the boundary that may satisfy the radius distance range when judging solely by the center point distance, a sub-mesh safety compensation distance is set. For square sub-mesh cells obtained according to the target index granularity, if the current sub-mesh cell number and the sub-mesh cell number to be compared use the same target index granularity, the sub-mesh safety compensation distance can be the sum of the half-diagonals of the two sub-mesh cells, specifically:

[0113] ;

[0114] ;

[0115] In the formula Indicates the current grid cell number The corresponding subgrid safety compensation distance, Indicates the current grid cell number The corresponding target index granularity, Indicates the sub-grid cell number In radius number The corresponding sub-adjacent mesh range, Indicates the sub-grid cell number to be compared. Indicates the sub-grid cell number Comparison with the sub-mesh cell number Euclidean distance between the center points Indicates radius number The upper limit of the corresponding radius distance range, Indicates the current grid cell number The corresponding subgrid safety compensation distance.

[0116] The range of ordinary adjacent grids is determined as follows: Since the target index granularity is equal to the original index granularity under the current radius number, the range of ordinary adjacent grids can be determined by the Euclidean distance between the center point of the current grid cell and the center point of the grid cell to be compared.

[0117] ;

[0118] In the formula, Indicates the grid cell number In radius number The corresponding normal adjacent grid range, Indicates the grid cell number to be compared. Indicates the grid cell number Comparison with the grid cell number Euclidean distance between the center points Indicates radius number The upper limit of the corresponding radius distance range, Indicates radius number The corresponding grid safety compensation distance.

[0119] By dividing the grid cell corresponding to the current grid cell number into sub-grid cells according to the target index granularity when the candidate retrieval load value reaches or exceeds the load threshold, local high-density regions can be further subdivided, thereby reducing the number of candidate source-target pairs generated in high-load regions. By reallocating spatial coordinates to sub-grid cell numbers, the local positions of cells can be further distinguished within the same original grid cell, providing finer spatial positioning basis when reading target cell sets. By determining the sub-adjacent grid range for each sub-grid cell number, the adjacency range of high-load regions can be changed from the overall adjacency of the current grid cell to the adjacency of individual sub-grid cells, reducing the number of target cells read in a single operation. When the candidate retrieval load value is less than the load threshold, a normal adjacency grid range is generated, avoiding unnecessary sub-grid division in low-load regions and reducing additional index maintenance costs.

[0120] When the candidate retrieval load value is less than the preset load threshold, the sub-grid is not refined. Instead, grid matching is performed based on the target index granularity and the radius distance range corresponding to the current radius number to generate a normal adjacent grid range. Since the target index granularity is equal to the original index granularity under the current radius number, the normal adjacent grid range can be determined by the Euclidean distance between the center point of the current grid cell and the center point of the grid cell to be compared.

[0121] Furthermore, generating candidate source-target pairs specifically includes: determining the grid cell number corresponding to the source cell based on the spatial coordinates of each source cell in the source cell set; reading the adjacent grid range from the radius adjacent grid mapping relationship based on the grid cell number and radius number corresponding to the source cell; when the adjacent grid range is a refined adjacent grid range, determining the sub-grid cell number corresponding to the source cell based on the spatial coordinates of the source cell, and reading the target cell set within the sub-adjacent grid range corresponding to the sub-grid cell number; when the adjacent grid range is a normal adjacent grid range, reading the target cell set within the normal adjacent grid range; filtering the target cell types of the read target cell set based on cell type labels, and associating the source cells with the filtered target cells to generate candidate source-target pairs.

[0122] In this embodiment, the grid cell number corresponding to the source cell can be determined by the spatial coordinates of the source cell. The processor reads the spatial coordinates of each source cell in the source cell set and determines the grid cell number to which the source cell falls according to the established correspondence between spatial coordinates and grid cell numbers in the sliced ​​spatial grid. This correspondence has been established when the sliced ​​spatial grid is generated, so the processor can directly query and obtain it without having to re-traverse all spatial coordinates.

[0123] The radius number can be read from the physical radius segmentation configuration. When generating candidate source-target pairs, the processor reads the corresponding radius number according to the radius distance range that needs to be analyzed, and uses the grid cell number corresponding to the source cell and the radius number as reading conditions to read the corresponding adjacent grid range from the radius adjacent grid mapping relationship.

[0124] The adjacency grid range includes refined adjacency grid range and normal adjacency grid range. If the processor reads the refined adjacency grid range, it means that the region corresponding to the current grid cell number was judged to have a high candidate retrieval load in the previous processing and has been divided into sub-grid cells according to the target index granularity. If the processor reads the normal adjacency grid range, it means that the region corresponding to the current grid cell number has not triggered sub-grid cell division and the target cell set can be read directly according to the normal adjacency grid range.

[0125] The criteria for target cell type screening can be pre-written by the user in the configuration file, such as cell type names that match the cell type labels in the basic spatial transcriptome data, like "immune cells," "tumor cells," or "fibroblasts." After reading the configuration file, the processor uses the read cell type names as screening criteria and compares them with the cell type labels of each data record within the adjacent grid range.

[0126] For regions with high candidate retrieval load, reading the target cell set based on a refined adjacency grid range can narrow the reading range in high-density regions and reduce the number of invalid candidate source-target pairs. For regions with low candidate retrieval load, the processor directly reads the target cell set based on a normal adjacency grid range, avoiding additional subgrid localization overhead. By combining cell type tags for target cell type screening, candidate source-target pairs can simultaneously satisfy spatial adjacency and cell type conditions, improving the matching degree between candidate source-target pairs and the analysis objective. This step, in the overall scheme, inherits the previous radius adjacency grid mapping relationship and refined adjacency grid range, enabling the load adjustment results of the previous steps to actually affect the candidate source-target pair generation process, thereby providing fewer and more accurate candidate objects for subsequent sparse indexing of candidate source-target pairs and lightweight analysis results of effective source-target pairs.

[0127] Furthermore, the generation of lightweight analysis results for effective source-target pairs based on the sparse index of candidate source-target pairs specifically includes: reading the expression matrix index corresponding to the source cell and the expression matrix index corresponding to the target cell based on the sparse index of candidate source-target pairs; reading the expression data of the source cell based on the expression matrix index corresponding to the source cell, and reading the expression data of the target cell based on the expression matrix index corresponding to the target cell; calculating the expression correlation based on the expression values ​​corresponding to the same gene number in the expression data of the source cell and the expression data of the target cell to obtain the expression association value; obtaining a preset expression association threshold and comparing it with the expression association value, selecting candidate source-target pairs with expression association values ​​above the expression association threshold as target candidate source targets, and generating lightweight analysis results for effective source-target pairs based on the target candidate source targets.

[0128] The lightweight analysis results of effective source-target pairs are generated based on the target candidate source-target. Specifically, this may include: after determining the target candidate source-target, the processor reads the candidate correspondence between the source cells and target cells corresponding to the target candidate source-target from the sparse index of the candidate source-target pairs, and reads the expression matrix index of the source cell, the expression matrix index of the target cell, the slice number, the radius number, the radius distance range, the cell type label of the source cell, the cell type label of the target cell, and the expression association value associated with the candidate correspondence; the processor stores the above data according to the same target candidate source-target to generate the lightweight analysis results of effective source-target pairs. The lightweight analysis results of effective source-target pairs are used to record the effective correspondence between source cells and target cells after screening by the expression association threshold, as well as the slice number, radius number, radius distance range, expression matrix index, cell type label, and expression association value corresponding to the effective correspondence.

[0129] In this embodiment, as Figure 3 As shown, Figure 3 The flowchart for generating candidate source-target pairs and generating lightweight analysis results of effective source-target pairs in this invention is as follows: The grid cell number is determined based on the spatial coordinates of the source cells; the adjacent grid range is read from the radius adjacent grid mapping relationship; when the adjacent grid range is a refined adjacent grid range, the target cell set within the sub-adjacent grid range is read; when the adjacent grid range is a normal adjacent grid range, the target cell set within the normal adjacent grid range is read; target cell types are screened based on cell type labels, and each candidate source-target pair is generated; the expression matrix index is read based on the sparse index of the candidate source-target pairs, the expression correlation value is calculated and compared with the expression correlation threshold, the target candidate source-target pairs are selected, and the lightweight analysis results of effective source-target pairs are generated.

[0130] Both source cell expression data and target cell expression data can be read from the expression matrix using expression matrix indexes. The processor first reads the expression matrix indices corresponding to the source cells and the target cells from the sparse index of candidate source-target pairs, and then locates the corresponding expression data in the expression matrix based on these expression matrix indices.

[0131] The candidate source-target pair sparse index records the candidate correspondences between source cells and target cells, and associates the expression matrix indices corresponding to the source cells and the target cells. The processor reads the source cell expression data based on the expression matrix index corresponding to the source cells, and reads the target cell expression data based on the expression matrix index corresponding to the target cells. To ensure consistency in the calculation of expression association values, the processor only selects the expression values ​​corresponding to the same gene numbers in the source cell expression data and target cell expression data for calculation.

[0132] Expression correlation values ​​are used to represent the degree of consistency between expression changes in source cells and target cells. The specific calculation method is as follows:

[0133] ;

[0134] ;

[0135] In the formula, Indicates the source cell number Mean expression value in the same gene ID set, This represents the number of gene IDs in a set of identical gene IDs. This represents the gene ID in a set of identical gene IDs. Indicates the source cell number and target cell number A set of genes with the same expression value. Indicates the source cell number In gene numbering The expression value below, Indicates target cell number Mean expression value in the same gene ID set, Indicates target cell number In gene numbering The expression value below.

[0136] ;

[0137] In the formula, Indicates the source cell number and target cell number The expression of correlation values ​​between them This represents the gene ID in a set of identical gene IDs. Indicates the source cell number and target cell number A set of genes with the same expression value. Indicates the source cell number In gene numbering The expression value below, Indicates target cell number In gene numbering The expression value below, Indicates the source cell number Mean expression value in the same gene ID set, Indicates target cell number Mean expression value in the same set of gene IDs.

[0138] By using a sparse index to read the expression matrix indices of source and target cells, expression data reading is limited to the candidate source-target pairs, rather than performing a full expression matrix scan on all cells. By calculating expression correlations using only the expression values ​​corresponding to the same gene IDs in the source and target cell expression data, consistency in the calculation objects for expression correlation values ​​is ensured, avoiding calculation biases caused by inconsistencies in the dimensions of source and target cell expression data. By comparing the expression correlation values ​​with preset expression correlation thresholds, target source-targets that meet the expression relationship criteria can be selected from the candidate source-target pairs. This avoids retaining too many weakly correlated or irrelevant source-target pairs based solely on spatial proximity, ensuring that expression calculations only occur on candidate source-target pairs filtered by spatial range, cell type, and index. This reduces the amount of expression matrix reading and expression correlation calculations, and improves the relevance of effective source targets to the lightweight analysis results.

[0139] like Figure 4 As shown, Figure 4The system structure diagram of this invention is shown below. An embodiment of this application provides a lightweight spatial transcriptome analysis system based on physical priors, comprising the following modules: a basic data index module, used to acquire basic spatial transcriptome data, including slice number, spatial coordinates, cell type labels, and expression matrix index; a slice spatial index is generated based on slice number and spatial coordinates; a radius segmentation configuration module, used to acquire a preset physical interaction distance and generate a physical interaction radius segmentation configuration in conjunction with the slice spatial index; a spatial grid generation module, used to divide the spatial region corresponding to each slice number into a grid based on the index granularity and the slice spatial index, generating a slice spatial grid; and an adjacency mapping generation module, used to determine the adjacency grid range corresponding to each physical interaction radius segment based on the radius distance range and the slice spatial grid, and to map each... The system associates the radius number, adjacent grid range, and grid cell number of the slice spatial grid corresponding to the physical action radius segment to generate a radius-adjacent grid mapping relationship. The source-target pair generation module determines the source cell set based on cell type labels and reads the target cell set within the corresponding adjacent grid range from the radius-adjacent grid mapping relationship based on the grid cell number of each source cell in the source cell set, generating candidate source-target pairs. The sparse index generation module filters each candidate source-target pair based on slice number, radius distance range, spatial coordinates, cell type label, and expression matrix index to obtain a candidate source-target pair sparse index, which records the candidate correspondence between source cells and target cells. The lightweight analysis module generates effective source-target pair lightweight analysis results based on the candidate source-target pair sparse index.

[0140] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.

Claims

1. A lightweight spatial transcriptome analysis method based on physical priors, characterized in that: Includes the following steps: Acquire basic spatial transcriptome data, which includes slice number, spatial coordinates, cell type labels, and expression matrix index. Analyze and generate a slice spatial index based on the slice number and spatial coordinates. Obtain the preset physical action distance and generate a segmented configuration of the physical action radius by combining it with the slice space index. The segmented configuration of the physical action radius includes the radius number, the radius distance range and the index granularity. Based on the index granularity and slice space index, the spatial region corresponding to each slice number is divided into a grid to generate a slice space grid. Based on the radius distance range and the slice space grid, the adjacent grid range corresponding to each physical action radius segment is determined, and the radius number, adjacent grid range, and grid cell number of the slice space grid corresponding to each physical action radius segment are associated to generate a radius adjacent grid mapping relationship. The source cell set is determined based on cell type labels, and the target cell set within the corresponding adjacent grid range is read from the radius adjacent grid mapping relationship based on the grid cell number of each source cell in the source cell set, thus generating each candidate source-target pair; Based on slice number, radius distance range, spatial coordinates, cell type label and expression matrix index, each candidate source-target pair is screened to obtain a sparse index of candidate source-target pairs. The sparse index of candidate source-target pairs is used to record the candidate correspondence between source cells and target cells. Lightweight analysis results of generating effective source-target pairs based on sparse indexing of candidate source-target pairs.

2. The lightweight spatial transcriptome analysis method based on physical priors according to claim 1, characterized in that: The generation of the slice spatial index based on slice number and spatial coordinate analysis specifically includes: The basic spatial transcriptome data were grouped according to the slice number to obtain the slice data group corresponding to each slice. The spatial coordinates in each slice data group are encoded with a predetermined number of bits to obtain the spatial coordinate code; By associating the slice number, spatial coordinate code, cell type label, and expression matrix index within the same slice data group, a slice spatial index is generated.

3. The lightweight spatial transcriptome analysis method based on physical priors according to claim 1, characterized in that: The configuration of physical action radius segments based on slice space indexing specifically includes: A preset number of radius distance ranges are generated based on a preset physical action distance, and a corresponding radius number is configured for each radius distance range; Based on the radius distance range and the preset granularity configuration rules, determine the index granularity corresponding to each radius number; Associate the radius number, radius distance range, and index granularity to generate a segmented configuration of the physical action radius.

4. The lightweight spatial transcriptome analysis method based on physical priors according to claim 1, characterized in that: The generation of the sliced ​​spatial mesh specifically includes: Read the spatial coordinates corresponding to each slice based on the slice spatial index, and determine the coordinate coverage area of ​​each slice; The coordinate coverage area is divided into multiple grid cells based on the index granularity. Each grid cell is assigned a grid cell number, and the grid cell number is associated with the spatial coordinates and representation matrix index of the corresponding grid cell to generate a sliced ​​spatial grid.

5. The lightweight spatial transcriptome analysis method based on physical priors according to claim 1, characterized in that: The generated radius adjacent mesh mapping relationship specifically includes: The number of cells in a grid is obtained by counting the number of cells corresponding to the grid cell number in the sliced ​​spatial grid. Based on the radius distance range and the number of grid cells corresponding to each physical action radius segment, candidate retrieval load prediction is performed to obtain the candidate retrieval load value of each grid cell number under the corresponding radius number. Obtain a preset load threshold and compare it with the candidate retrieval load value. If the candidate retrieval load value is above the load threshold, match the candidate retrieval load value with the preset load granularity adjustment rule to obtain the index granularity adjustment value. Based on the index granularity adjustment value, reduce the index granularity under the corresponding radius number to obtain the target index granularity. If the candidate retrieval load value is less than the load threshold, then the index granularity under the current corresponding radius number will be used as the target index granularity. Adjacency range determination is performed based on the target index granularity to obtain the adjacent grid range of the corresponding grid cell number under the current radius number; The radius number, grid cell number, candidate retrieval load value, target index granularity, and adjacent grid range are associated to generate a radius-adjacent grid mapping relationship.

6. The lightweight spatial transcriptome analysis method based on physical priors according to claim 5, characterized in that: The generation of candidate retrieval load values ​​specifically includes: The initial set of adjacent grid cells corresponding to the current grid cell number is determined based on the radius distance range; Read the number of cells corresponding to each grid cell number in the initial adjacent grid set from the grid cell count; The number of cells corresponding to the grid cell numbers in the initial adjacent grid set is accumulated to obtain the number of candidate cells; Based on the cell type label, the number of cells that meet the preset source cell type conditions within the current grid cell number is counted to obtain the estimated number of source cells; Based on the analysis of the number of candidate cells and the estimated number of source cells, the candidate retrieval load value is obtained; The candidate retrieval load value is used to characterize the data processing load for generating candidate source target pairs under the corresponding radius number of the current grid cell number.

7. The lightweight spatial transcriptome analysis method based on physical priors according to claim 5, characterized in that: The specific steps for obtaining the adjacent grid range of the corresponding grid cell number under the current radius number include: If the candidate retrieval load value corresponding to the current grid cell number is above the preset load threshold, the grid cell corresponding to the current grid cell number is divided into sub-grid cells according to the target index granularity to obtain the sub-grid cell number, and the spatial coordinates falling into the corresponding grid cell number are redistributed to the corresponding sub-grid cell number. Based on the radius distance range corresponding to the current radius number, determine the sub-adjacent grid range corresponding to each sub-grid cell number; Associate the current grid cell number, each sub-grid cell number, and each sub-adjacent grid range to generate the refined adjacent grid range corresponding to the current grid cell number under the current radius number; If the candidate retrieval load value is less than the preset load threshold, then grid matching is performed based on the target index granularity and the radius distance range corresponding to the current radius number to generate the ordinary adjacent grid range corresponding to the current grid cell number under the current radius number; The adjacent grid range includes a refined adjacent grid range and a normal adjacent grid range.

8. The lightweight spatial transcriptome analysis method based on physical priors according to claim 7, characterized in that: The generation of each candidate source-target pair specifically includes: The grid cell number corresponding to each source cell is determined based on the spatial coordinates of each source cell in the source cell set. Based on the grid cell number and radius number corresponding to the source cell, the range of adjacent grids is read from the radius adjacent grid mapping relationship; When the adjacent grid range is a refined adjacent grid range, the sub-grid cell number corresponding to the source cell is determined based on the spatial coordinates of the source cell, and the target cell set within the sub-adjacent grid range corresponding to the sub-grid cell number is read. When the adjacent grid range is a normal adjacent grid range, the target cell set within the normal adjacent grid range is read. The target cell type is screened based on the cell type tag, and the source cells are associated with the screened target cells to generate candidate source-target pairs.

9. The lightweight spatial transcriptome analysis method based on physical priors according to claim 1, characterized in that: The lightweight analysis results for generating effective source-target pairs based on the sparse index of candidate source-target pairs specifically include: Based on the sparse index of candidate source-target pairs, the expression matrix indexes corresponding to the source cells and the expression matrix indexes corresponding to the target cells are read. Source cell expression data is read based on the expression matrix index corresponding to the source cell, and target cell expression data is read based on the expression matrix index corresponding to the target cell. The expression correlation value is obtained by calculating the expression values ​​corresponding to the same gene number in the source cell expression data and the target cell expression data. Obtain a preset expression association threshold and compare it with the expression association value. Select candidate source-target pairs whose expression association value is above the expression association threshold as target candidate source-targets. Generate lightweight analysis results of effective source-target pairs based on the target candidate source-targets.

10. A system applying the lightweight spatial transcriptome analysis method based on physical priors as described in any one of claims 1-9, characterized in that: Includes the following modules: The basic data indexing module is used to obtain basic spatial transcriptome data, which includes slide number, spatial coordinates, cell type labels and expression matrix index. The slide spatial index is generated based on the slide number and spatial coordinates. The radius segmentation configuration module is used to obtain the preset physical action distance and generate the physical action radius segmentation configuration by combining the slice space index; The spatial grid generation module is used to divide the spatial region corresponding to each slice number into a grid based on the index granularity and slice spatial index, and generate a slice spatial grid. The adjacency mapping generation module is used to determine the adjacency grid range corresponding to each physical action radius segment based on the radius distance range and the slice space grid, and associate the radius number, adjacency grid range, and grid cell number of each physical action radius segment with the slice space grid to generate a radius adjacency grid mapping relationship. The source-target pair generation module is used to determine the source cell set based on the cell type label, and based on the grid cell number of each source cell in the source cell set, read the target cell set within the corresponding adjacent grid range from the radius adjacent grid mapping relationship to generate each candidate source-target pair; The sparse index generation module is used to filter each candidate source-target pair based on slice number, radius distance range, spatial coordinates, cell type label and expression matrix index to obtain a sparse index of candidate source-target pairs. The sparse index of candidate source-target pairs is used to record the candidate correspondence between source cells and target cells. The lightweight analysis module is used to generate lightweight analysis results of effective source-target pairs based on the sparse index of candidate source-target pairs.