Food web construction method and apparatus
By acquiring stable carbon and nitrogen isotope data and a Bayesian mixture model, the feeding relationships are automatically identified and iteratively optimized. This solves the problems of subjectivity in manual judgment and lack of iterative optimization in traditional food web construction methods, realizes the automation and quantitative identification of food web structure, and improves the accuracy of feeding relationships and the robustness of food web.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING WATER SCI & TECH INST
- Filing Date
- 2026-04-08
- Publication Date
- 2026-07-07
AI Technical Summary
Traditional food web construction methods rely on manual determination of food relationships, which is highly subjective and lacks iterative optimization mechanisms. The food matrix cannot quantify the contribution ratio of food sources, and isotope measurement errors and ecological variability are not effectively quantified.
By acquiring stable carbon and nitrogen isotope data, a Bayesian mixture model is used to automatically identify the dietary relationships between consumers and potential food sources, generate an initial dietary matrix, and construct a food web structure that reflects energy flow relationships by iteratively optimizing and eliminating secondary food sources.
It enables automated, quantitative identification and optimization of food web structures, reduces the subjectivity of manual judgment, improves the accuracy of food relationship and the robustness of food webs, and can quantitatively reflect the contribution of food sources.
Smart Images

Figure CN122347979A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of ecoinformatics and ecosystem health assessment, specifically to a method and apparatus for constructing food webs. Background Technology
[0002] Traditional food web construction methods have the following shortcomings: the identification of food relationships relies on manual judgment, which is highly subjective and labor-intensive; the food matrix is mostly in binary form, which cannot quantify the contribution ratio of food sources; the food web construction process is a one-time calculation and lacks an iterative optimization mechanism based on data feedback; and isotope measurement errors and ecological variability are not effectively quantified. Summary of the Invention
[0003] This invention provides a food web construction method and apparatus to solve the problems of existing food web construction methods, which rely on manual judgment for identifying food relationship and lack an iterative optimization mechanism.
[0004] In a first aspect, the present invention provides a method for constructing a food web, the method comprising: Obtain stable carbon and nitrogen isotope data from biological samples in the region to be analyzed; Based on carbon and nitrogen stable isotope data, we identify dietary relationships between consumers and potential food sources and generate an initial dietary matrix. Based on a pre-built Bayesian mixture model, the diet relationships in the initial diet matrix are iteratively optimized to generate an optimized diet matrix; Based on the optimized diet matrix, a food web structure reflecting the energy flow relationships among species is constructed.
[0005] This invention provides a food web construction method that automatically identifies the dietary relationships between consumers and potential food sources and generates an initial dietary matrix by acquiring stable carbon and nitrogen isotope data. This avoids the subjectivity and workload of manually determining dietary relationships and solves the problem that existing food web construction methods rely on manual determination for dietary relationship identification. Furthermore, by iteratively optimizing the initial dietary matrix using a Bayesian mixture model, secondary food sources are automatically eliminated, addressing the lack of an iterative optimization mechanism in traditional methods that involve one-time calculations. This results in a clearer and more robust food web structure.
[0006] In one alternative implementation, based on carbon and nitrogen stable isotope data, dietary relationships between consumers and potential food sources are identified, and an initial dietary matrix is generated, including: Based on the ecological tags or cluster analysis results of biological samples, biological samples are classified into consumers and potential food sources. Based on carbon and nitrogen stable isotope data, dietary relationships between consumers and potential food sources are identified in a pre-constructed two-dimensional isotope space. An initial diet matrix is generated by using consumers as rows, potential food sources as columns, and diet relationships as matrix elements.
[0007] In the above technical solution, consumers and potential food sources are automatically classified through ecological tags or cluster analysis without the need for manual pre-setting; by automatically identifying dietary relationships in two-dimensional isotopic space, the manual judgment that relies on literature review or field observation in traditional methods is avoided, reducing subjectivity and workload; the generated initial dietary matrix provides a data foundation for subsequent iterative optimization.
[0008] In one alternative implementation, the carbon and nitrogen stable isotope data includes: a first isotope and a second isotope; the two-dimensional isotope space is constructed in the following manner: A two-dimensional isotope space is constructed with the first isotope as the vertical axis and the second isotope as the horizontal axis.
[0009] In the above technical solution, by constructing a two-dimensional isotope space with the first isotope as the vertical axis and the second isotope as the horizontal axis, the isotope data of consumers and potential food sources are mapped to the same space, providing a unified spatial coordinate system for subsequent identification of dietary relationships, which facilitates quantitative analysis of the spatial positional relationship between consumers and potential food sources.
[0010] In one alternative implementation, based on carbon and nitrogen stable isotope data, dietary relationships between consumers and potential food sources are identified in a pre-constructed two-dimensional isotope space, including: The first and second isotopes of consumers, as well as the first and second isotopes of potential food sources, are used as data points and mapped to a two-dimensional isotope space. Analyze the distribution characteristics of each data point in two-dimensional isotope space to calculate the spatial distance or overlap between consumers and potential food sources; Based on the nutritional location indication function of the first isotope and the food source indication function of the second isotope, a dual isotope synergistic screening is conducted to determine the spatial relationship between consumers and potential food sources. In two-dimensional isotopic space, based on the spatial distance or overlap between consumers and potential food sources, and the results of dual isotope synergistic screening, potential predator-prey relationships are identified as dietary relationships between consumers and potential food sources.
[0011] In the above technical solution, by mapping the isotopic data of consumers and potential food sources to a two-dimensional isotopic space, the dietary relationship is analyzed quantitatively using spatial distance or overlap. Furthermore, the nutritional location indication function of the first isotope and the food source indication function of the second isotope are used for dual isotope collaborative screening. This achieves automatic and quantitative identification of dietary relationships, avoids the subjectivity of traditional methods that rely on manual judgment, and improves the accuracy and objectivity of dietary relationship identification.
[0012] In one optional implementation, based on a pre-built Bayesian mixture model, the feeding relationships in the initial feeding matrix are iteratively optimized to generate an optimized feeding matrix, including: The pre-constructed Bayesian mixture model is solved using a random sampling method to obtain the posterior distribution of the contribution ratio of each potential food source, and the mean contribution ratio is calculated. The average contribution ratio is compared with a preset threshold, and potential food source connections with an average contribution ratio lower than the preset threshold are removed. The contribution ratio of retained potential food sources was renormalized. Repeat the steps of solving, comparing, and normalizing the Bayesian mixture model until the connections of the eliminated potential food sources no longer change or the preset number of iterations is reached, and generate the optimized diet matrix.
[0013] In the above technical solution, the posterior distribution of the contribution ratio of each potential food source is obtained by solving the Bayesian mixture model and the mean contribution ratio is calculated. The connection of potential food sources with low contribution ratio is automatically removed by using a preset threshold, and the contribution ratio of the retained food sources is renormalized. Through iterative optimization until convergence, the dynamic screening and optimization of food relationships is realized, which solves the problem of the lack of iterative optimization mechanism in traditional methods. This makes the constructed food matrix focus on the core food relationships and eliminates the noise interference of secondary food sources.
[0014] In one alternative implementation, the Bayesian mixture model is constructed as follows: The Dirichlet prior distribution is determined by using the proportion of each potential food source to consumers as the parameter to be estimated. Based on the average carbon and nitrogen stable isotope values and contribution ratios of each potential food source, the expected value of the carbon and nitrogen stable isotope ratio for consumers is calculated by correcting with a nutrient enrichment factor. Based on the difference between the measured and expected values of the carbon-nitrogen stable isotope ratio of consumers, a normal likelihood function is constructed. The normal likelihood function is used to characterize that the measured value follows a normal distribution with the expected value as the mean and the preset variance as the variance. By combining the Dirichlet prior distribution with the normal likelihood function using Bayes' theorem, a posterior distribution of the contribution ratio is constructed, resulting in a Bayesian mixture model.
[0015] In the above technical solution, the prior information describing the contribution ratio is determined by the Dirichlet prior distribution, the expected value of the consumer isotope ratio is calculated by correcting with the nutrient enrichment factor, and a normal likelihood function is constructed based on the difference between the measured value and the expected value. The posterior distribution of the contribution ratio is obtained by combining the prior distribution and the likelihood function through Bayes' theorem. This realizes the quantification of the uncertainty of the contribution ratio of food sources and solves the problem of traditional methods ignoring isotope measurement errors and ecological variability.
[0016] In one optional implementation, a food web structure reflecting energy flow relationships among species is constructed based on the optimized diet matrix, including: Extract all consumers and all potential food sources as nodes from the optimized diet matrix, and use diet relationships with a contribution ratio greater than zero as directed edges connecting consumers and food sources, with the corresponding contribution ratio as the weight of the edge. Based on nodes and directed edges, a directed graph representing the direction of energy flow between species is constructed as the food web structure.
[0017] In the above technical solution, consumers and potential food sources are extracted from the optimized diet matrix as nodes, diet relationships with a contribution ratio greater than zero are used as directed edges, and the contribution ratio is used as the weight of the edge. A directed graph representing the direction of energy flow is constructed as the food web structure, realizing the transformation of the food web from a binary matrix to a weighted directed graph, so that the food web structure can quantitatively reflect the actual contribution of food sources.
[0018] In one alternative implementation, the method further includes: Based on the food web structure and the optimized diet matrix, a weighted omnivorousness index is calculated to quantitatively assess the functional stability of the food web structure. The weighted omnivorousness index is calculated using the following formula: ; in, Indicates the weighted omnivorousness index. The proportion of contribution to potential food sources, For weighted average trophic level, Nutritional level for potential food sources.
[0019] In the above technical solution, a weighted omnivorous index is calculated based on the food web structure and the optimized diet matrix. The contribution ratio of potential food sources is used as the weight to quantify the diversity of consumers' eating strategies. This solves the problem that the traditional omnivorous index ignores the contribution weight of food sources and realizes an objective quantitative assessment of the functional stability of the food web.
[0020] In one alternative implementation, the method further includes: Based on carbon and nitrogen stable isotope data or food web structure, the system automatically identifies the benchmark species whose trophic level is a preset value and assigns a benchmark trophic level to the benchmark species. Based on the optimized diet matrix, the trophic level of all species is calculated iteratively until the trophic level of all species converges. The trophic level of all species includes the consumer trophic level and the potential food source trophic level. Each consumer trophic level is the weighted average of all potential food source trophic levels plus a preset value. The trophic level calculations were checked and corrected so that each consumer’s trophic level was higher than the corresponding potential food source’s trophic level, and all species’ trophic levels were not lower than the baseline trophic level.
[0021] In the above technical solution, a baseline species is automatically identified and assigned a baseline trophic level by using carbon and nitrogen stable isotope data or food web structure. The trophic level of all species is then iteratively calculated based on the optimized diet matrix until convergence. The consumer trophic level is calculated by adding a preset value to the weighted average value, and then checked and corrected to ensure that the consumer trophic level is higher than its food source and that the trophic level of all species is not lower than the baseline trophic level. This achieves automatic and iterative calculation of trophic levels and verification of ecological rationality, solving the problems of unclear baseline identification and systematic bias in trophic level estimation in traditional methods.
[0022] In a second aspect, the present invention provides a food web construction apparatus, the apparatus comprising: The data acquisition module is used to acquire stable carbon and nitrogen isotope data of biological samples from the area to be analyzed. The diet matrix generation module is used to identify the diet relationships between consumers and potential food sources based on carbon and nitrogen stable isotope data, and to generate an initial diet matrix. The matrix optimization module is used to iteratively optimize the diet relationships in the initial diet matrix based on a pre-built Bayesian mixture model, and generate an optimized diet matrix. The food web construction module is used to construct a food web structure that reflects the energy flow relationships between species based on the optimized diet matrix.
[0023] Thirdly, the present invention provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the food web construction method described in the first aspect or any corresponding embodiment thereof.
[0024] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the food web construction method described in the first aspect or any corresponding embodiment thereof.
[0025] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the food web construction method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0026] 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.
[0027] Figure 1 This is a schematic diagram of an application scenario according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the first process of a food web construction method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of a second process for constructing a food web according to an embodiment of the present invention; Figure 4 This is a structural block diagram of a food web construction apparatus according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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.
[0029] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0030] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0031] As an optional application scenario of this invention, such as Figure 1 As shown, application 101 is installed in terminal device 110, and user 130 can interact with application 101 through terminal device 110 and / or access device of terminal device 110.
[0032] For example, application 101 can be any application that provides question-and-answer related services. For instance, application 101 could be a question-and-answer interactive application, such as a text-to-text application, an image-to-text application, etc. Figure 1 In the application scenario shown, if application 101 is active, the terminal device 110 can display the interface 102 of application 101. The interface 102 may include various pages that application 101 can provide, such as interactive pages, settings pages, query pages, etc.
[0033] In some embodiments, terminal device 110 is communicatively connected to server 120 to provide services to application 101. Terminal device 110 may be a mobile terminal, fixed terminal, or portable terminal, etc., including but not limited to mobile phones, desktop computers, laptop computers, multimedia tablets, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. In some embodiments, terminal device 110 may also support any type of interface, and server 120 may be various types of computing systems or servers capable of providing computing power, including but not limited to mainframes, edge computing nodes, computing devices in cloud environments, etc.
[0034] It should be noted that, Figure 1 This is merely an example of an application scenario and does not limit the scope of protection of this invention.
[0035] The embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the pages shown in the drawings are merely examples, and various page designs are possible in practice. The various graphic elements on the page may have different arrangements and different visual representations, one or more elements may be omitted or replaced, and one or more other elements may also be present; no limitations are imposed in the embodiments of the present invention. Furthermore, the embodiments are described below primarily with respect to terminal device 110. It should be understood that the actions described relative to terminal device 110 can be performed by application 101 on terminal device 110, or by application 101 in conjunction with its server (e.g., server 120). According to an embodiment of the present invention, a food web construction method embodiment is provided. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0036] This embodiment provides a method for constructing a food web, which can be used in the aforementioned electronic or terminal devices. Figure 2 This is a flowchart of a food web construction method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain stable carbon and nitrogen isotope data of biological samples from the region to be analyzed.
[0037] The area to be analyzed refers to the target geographical area where food web construction and ecosystem assessment are required, such as specific water bodies or ecosystem ranges like rivers, lakes, watersheds, or oceans.
[0038] Biological samples refer to biological samples collected from the area to be analyzed, including individual species or tissues of different trophic levels such as producers (e.g., algae, aquatic plants) and consumers (e.g., zooplankton, fish, benthic animals).
[0039] Carbon and nitrogen stable isotope data refer to the carbon (δ¹³C) content in biological samples measured by analytical instruments such as mass spectrometers. 13 C) and nitrogen (δ) 15 The stable isotope ratios of N are used to indicate the food source and nutrient location of organisms, respectively.
[0040] Specifically, biological samples are collected from the area to be analyzed. After pretreatment such as washing, drying, and grinding, the δ¹² values of the samples are determined using a stable isotope ratio mass spectrometer. 13 C and δ 15 The N value is used to obtain carbon and nitrogen stable isotope data for dietary relationship identification and food web construction, which are the measured values of carbon and nitrogen stable isotopes.
[0041] Step S202: Based on carbon and nitrogen stable isotope data, identify the dietary relationships between consumers and potential food sources, and generate an initial dietary matrix.
[0042] Consumers refer to organisms that obtain energy through feeding in the food web, including primary consumers (such as herbivorous zooplankton and herbivorous fish), secondary consumers (such as carnivorous fish), and apex predators, whose trophic level is usually greater than 1.
[0043] Potential food sources refer to organisms or organic matter in an ecosystem that may be consumed by consumers, including producers (such as algae and aquatic plants), organic detritus, and other consumers at lower trophic levels, which are sources of energy and nutrition for consumers.
[0044] Feeding relationships refer to the predation connections between consumers and potential food sources, reflecting the pathways through which energy and nutrients flow from food sources to consumers. In a food web, feeding relationships manifest as predation or grazing behavior of consumers towards specific food sources, and are the basic units that construct the food web structure.
[0045] The initial diet matrix is generated by automatically identifying the diet relationships between consumers and potential food sources based on carbon and nitrogen stable isotope data. It consists of consumers as rows and potential food sources as columns, with the matrix elements representing the identified diet relationships. It is used to characterize whether there is a feeding relationship between consumers and potential food sources.
[0046] Specifically, based on carbon and nitrogen stable isotope data, biological samples are divided into consumers and potential food sources through ecological tagging or cluster analysis. The spatial relationship between consumers and potential food sources is analyzed in two-dimensional isotope space to identify consumer-potential food source pairs with feeding relationships. An initial diet matrix is constructed with consumers as rows and potential food sources as columns.
[0047] Step S203: Based on the pre-built Bayesian mixture model, iteratively optimize the diet relationships in the initial diet matrix to generate an optimized diet matrix.
[0048] Among them, the Bayesian mixture model is a mathematical model based on Bayesian statistical inference, used to quantitatively calculate the contribution proportion of each potential food source to a consumer. This model uses the contribution proportion of each food source as the parameter to be estimated, sets a Dirichlet prior distribution, corrects the consumer's expected isotope value using a nutrient enrichment factor, and constructs a normal likelihood function based on the difference between the measured isotope values and the expected values. Then, using Bayes' theorem, the prior distribution and the likelihood function are combined to obtain the posterior distribution of the contribution proportion, thereby quantifying the actual contribution and uncertainty of each food source to the consumer.
[0049] Specifically, a Bayesian mixture model containing nutrient enrichment factors is established, and an iterative optimization process is introduced: initial identification → contribution calculation → threshold screening → re-identification → convergence determination; secondary food sources (such as those with a contribution ratio of <5%) are automatically removed through multiple iterations to obtain an optimized diet matrix, thereby optimizing the food web structure.
[0050] Step S204: Based on the optimized diet matrix, construct a food web structure that reflects the energy flow relationship between species.
[0051] Specifically, all consumers and potential food sources are extracted from the optimized diet matrix as nodes, and diet relationships with a contribution ratio greater than zero are used as directed edges, with the weight of the edge being the corresponding contribution ratio. A directed graph representing the direction of energy flow is constructed as the food web structure.
[0052] The food web construction method provided in this embodiment automatically identifies the dietary relationships between consumers and potential food sources and generates an initial dietary matrix by acquiring stable carbon and nitrogen isotope data. This avoids the subjectivity and workload of manually determining dietary relationships and solves the problem that existing food web construction methods rely on manual determination for dietary relationship identification. Furthermore, by iteratively optimizing the initial dietary matrix using a Bayesian mixture model, secondary food sources are automatically eliminated, which solves the problem of traditional methods lacking an iterative optimization mechanism for one-time calculations, making the constructed food web structure clearer and more robust.
[0053] This embodiment provides a method for constructing a food web, which can be used in the aforementioned electronic or terminal devices. Figure 3 This is a flowchart of a food web construction method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps: Step S301: Obtain stable carbon and nitrogen isotope data of the biological sample from the area to be analyzed. For details, please refer to [link to relevant documentation]. Figure 2 Step S201 of the illustrated embodiment will not be described again here.
[0054] Step S302: Based on carbon and nitrogen stable isotope data, identify the dietary relationships between consumers and potential food sources, and generate an initial dietary matrix.
[0055] Specifically, step S302 includes: Step S3021: Based on the ecological tags or cluster analysis results of the biological samples, the biological samples are classified into consumers and potential food sources.
[0056] Step S3022: Based on carbon and nitrogen stable isotope data, identify the dietary relationships between consumers and potential food sources in a pre-constructed two-dimensional isotope space.
[0057] In one alternative implementation, the carbon and nitrogen stable isotope data includes: a first isotope and a second isotope; the two-dimensional isotope space is constructed in the following manner: A two-dimensional isotope space is constructed with the first isotope as the vertical axis and the second isotope as the horizontal axis.
[0058] The first isotope is nitrogen (δ¹⁸O). 15 N), the second isotope is carbon (δ). 13 C).
[0059] Specifically, through carbon and nitrogen isotopes (δ¹ 5 Measured values of N and δ¹³C automatically identify potential food sources without requiring manual pre-defined food relationships; a carbon and nitrogen dual isotope synergistic verification mechanism utilizes δ¹³C... 5 The ecological significance difference between N and δ¹³C (δ¹³C) 5N reflects nutrient location, δ¹³C indicates food source), in δ¹³ 5 Automatic clustering in two-dimensional isotopic space of N and δ¹³C to identify dietary relationships between food sources and consumers; establishment of dual isotope consistency test to automatically identify abnormal data points, improve the accuracy and reliability of food web construction, and realize the technological leap from "human experience judgment" to "data-driven automatic identification".
[0060] In some optional implementations, step S3022 above includes: Step a1: The first and second isotopes of consumers, as well as the first and second isotopes of potential food sources, are all mapped into a two-dimensional isotope space as data points.
[0061] Specifically, the measured values of the first and second isotopes of consumers and potential food sources are used as data points and plotted together in a two-dimensional isotope space with the first isotope as the vertical axis and the second isotope as the horizontal axis.
[0062] Step a2: Analyze the distribution characteristics of each data point in two-dimensional isotope space and calculate the spatial distance or overlap between consumers and potential food sources.
[0063] Specifically, the distribution characteristics of each data point in two-dimensional isotope space are analyzed, and the spatial distance or overlap between consumer data points and potential food source data points is calculated to quantify their proximity in isotope space.
[0064] Step a3: Based on the nutritional location indication function of the first isotope and the food source indication function of the second isotope, a dual isotope synergistic screening is performed on the spatial relationship between consumers and potential food sources.
[0065] Specifically, using the first isotope δ¹ 5 The nutritional location indicator function of N determines whether the consumer's trophic level is higher than that of the potential food source, and the food source indicator function of the second isotope δ¹³C determines whether the food sources of the two are similar, thus co-screening the spatial relationship between the consumer and the potential food source.
[0066] Step a4: In two-dimensional isotopic space, based on the spatial distance or overlap between consumers and potential food sources, and the results of dual isotopic synergistic screening, potential predator-prey relationships are identified as dietary relationships between consumers and potential food sources.
[0067] Specifically, in two-dimensional isotopic space, by combining spatial distance or overlap and dual isotope synergistic screening results, consumer-food source pairs that meet the requirements of spatial proximity and dual isotope synergistic verification are identified as potential predator-prey relationships, i.e., dietary relationships between consumers and potential food sources.
[0068] Step S3023: Generate an initial diet matrix with consumers as rows, potential food sources as columns, and diet relationships as matrix elements.
[0069] Specifically, the arrangement of the diet matrix is automatically identified by detecting the format characteristics of the input data: if the data contains a "+" sign, the row and column directions of consumers and food sources are inferred based on the distribution of the sign; if the first column contains species names and the other columns are numerical, the standard format of the first column being consumers and the first row being food sources is adopted; if the first row is functional group keywords, the transposed format of the first row being food sources and the first column being consumers is adopted; otherwise, a general parsing method is used to finally output a standardized initial diet matrix.
[0070] The input data refers to the original data frame used in the intelligent diet matrix recognition algorithm. This data frame contains diet relationship information of biological samples and can be in various formats such as a matrix with diet relationships marked by "+" symbols, or a table with species names and behavioral function groups as row and column labels. It is the data source for generating the initial diet matrix.
[0071] Step S303: Based on the pre-built Bayesian mixture model, iteratively optimize the diet relationships in the initial diet matrix to generate an optimized diet matrix.
[0072] In one alternative implementation, the Bayesian mixture model is constructed as follows: Using the contribution ratio of each potential food source to consumers as the parameter to be estimated, the Dirichlet prior distribution is determined. Based on the average carbon and nitrogen stable isotope values and contribution ratios of each potential food source, a nutrient enrichment factor is used for correction, and the expected value of the consumer's carbon and nitrogen stable isotope ratio is calculated. Based on the difference between the measured and expected values of the consumer's carbon and nitrogen stable isotope ratio, a normal likelihood function is constructed. The normal likelihood function is used to characterize that the measured values follow a normal distribution with the expected value as the mean and the preset variance as the variance. By combining the Dirichlet prior distribution with the normal likelihood function through Bayes' theorem, the posterior distribution of the contribution ratio is constructed, resulting in a Bayesian mixture model.
[0073] More specifically, the core assumption of the Bayesian mixture model is that a consumer's isotopic signature is the result of a mixture of isotopic signatures from different food sources in a certain proportion, corrected for nutrient enrichment. The model construction process includes: A prior distribution is set, and the contribution ratio of each food source to the consumer is regarded as a multidimensional random variable. Its prior distribution follows a Dirichlet distribution. Initially, it is assumed that all food sources are equally likely. Considering the nutrient bioaccumulation effect, and based on ecological knowledge, we set a δo value for each trophic level increase. 15 N enriched at 3.4‰, δ 13C enrichment was 1.0‰. Based on this, the expected value of the isotope ratio in the consumer's body was calculated according to the contribution ratio of each food source and its average isotope value. To quantify uncertainty, we comprehensively consider the standard deviation of isotope values of the food source itself (intraspecific differences) and the unexplained variation of the model itself to construct the expected variance of consumer isotope values. Construct a likelihood function, treating the actual measurements of consumers as a normal distribution sample centered on the model expectation value and with the model variance as the dispersion.
[0074] In step S303, when calculating the contribution of consumer food sources using carbon and nitrogen stable isotope data, an iterative optimization mechanism of a Bayesian mixture model is introduced to automatically identify and eliminate secondary food sources and focus on core energy channels.
[0075] Step S303 above includes: Step S3031: Solve the pre-constructed Bayesian mixture model using a random sampling method to obtain the posterior distribution of the contribution ratio of each potential food source, and calculate the mean contribution ratio.
[0076] For a sample set containing multiple consumers, each consumer corresponds to carbon (δ¹³C) and nitrogen (δ¹³C). 5 N) Stable isotope ratio data. The dietary analysis process for each consumer is as follows: First, the data preparation phase. This involves acquiring the consumer's stable carbon and nitrogen isotope data, and obtaining isotopic characteristics of pre-defined potential food sources. Information for each food source includes its δ¹⁸⁻¹... 5 Mean and standard deviation of N and δ¹³C.
[0077] Secondly, the Markov chain Monte Carlo method was used to sample the constructed Bayesian mixture model to obtain the posterior distribution of the contribution proportion of each potential food source. Statistical analysis of the posterior samples yielded the mean contribution proportion of each potential food source.
[0078] Step S3032: Compare the average contribution ratio with a preset threshold, and remove potential food source connections whose average contribution ratio is lower than the preset threshold; renormalize the contribution ratio of the retained potential food sources.
[0079] Specifically, this step involves performing an iterative optimization step. The calculated average contribution ratio of each potential food source is compared with a preset threshold (e.g., 5%), automatically identifying and filtering out significant food sources whose contribution ratio is greater than or equal to this threshold. If the contribution ratio of all food sources is lower than this threshold, the top three with the highest contribution ratios are automatically selected as significant food sources. Then, only these filtered significant food sources are retained, and their contribution ratios are normalized again so that their sum is 1.
[0080] Step S3033: Repeat the steps of solving, comparing and normalizing the Bayesian mixture model until the connections of the eliminated potential food sources no longer change or the preset number of iterations is reached, and generate the optimized diet matrix.
[0081] Output: Store the final, optimized food source contribution ratio of this consumer for subsequent food web construction and analysis.
[0082] Through the above iterative optimization mechanism, "noisy" food relationships with extremely low contribution ratios can be automatically filtered out, making the constructed food web structure simpler and the core energy pathways clearer.
[0083] Step S304: Based on the optimized diet matrix, construct a food web structure that reflects the energy flow relationship between species.
[0084] Specifically, step S304 includes: Step S3041: Extract all consumers and all potential food sources as nodes from the optimized diet matrix, and use diet relationships with a contribution ratio greater than zero as directed edges connecting consumers and food sources, and use the corresponding contribution ratio as the weight of the edge.
[0085] Step S3042: Based on nodes and directed edges, construct a directed graph representing the direction of energy flow between species as the food web structure.
[0086] Step S305: Based on the food web structure and the optimized diet matrix, calculate the weighted omnivorousness index to quantitatively evaluate the functional stability of the food web structure.
[0087] The weighted omnivorousness index uses a variance algorithm, with the variance of the food source trophic level as the weighted omnivorousness index. The weighted omnivorousness index more accurately reflects consumers' actual eating strategies, especially for the assessment of omnivorous species.
[0088] Its weighted omnivorousness index is calculated using the following formula: ; in, Indicates the weighted omnivorousness index. The proportion of contribution to potential food sources, For weighted average trophic level, Nutritional level for potential food sources.
[0089] Grading criteria based on weighted omnivorousness index: Low omnivorousness: ≤0.2; Moderately omnivorous: Located between 0.2 and 0.5; Highly omnivorous: >0.5.
[0090] Step S306, trophic level iterative calculation, includes: Based on carbon and nitrogen stable isotope data or food web structure, the system automatically identifies the baseline species with a preset trophic level and assigns a baseline trophic level to the baseline species. Based on the optimized diet matrix, the system iteratively calculates the trophic levels of all species until the trophic levels of all species converge. The trophic levels of all species include consumer trophic levels and potential food source trophic levels. Each consumer trophic level is the weighted average of all corresponding potential food source trophic levels plus a preset value. The system checks and corrects the trophic level calculation results so that each consumer trophic level is higher than the corresponding potential food source trophic level, and the trophic levels of all species are not lower than the baseline trophic level.
[0091] More specifically, the trophic level iterative calculation includes: The first step is to automatically identify the baseline species. The baseline species is the producer defined as trophic level 1. The algorithm first checks for the presence of carbon and nitrogen isotope data. If present, it adds δ¹⁸⁻ to the sample. 5 The species with the smallest N value is identified as the baseline species. If the data is incomplete or isotopic data is unavailable, the baseline species is identified from the network topology of the diet matrix, i.e., species that have never appeared as predators in the row index of the diet matrix, or species with zero intake, are identified as baseline species.
[0092] The second step is to initialize the trophic levels. Assign trophic level 1.0 to all identified baseline species.
[0093] The third step is to iteratively calculate trophic levels. This is a cyclical process that continues until the trophic levels of all species converge or the maximum number of iterations (e.g., 100) is reached. In each iteration, all consumers (predators) whose trophic levels have not yet been calculated or need updating are traversed. For each consumer, all its food sources are identified from the diet matrix. Among these food sources, species whose trophic levels have been calculated before this iteration are selected. Based on the contribution ratio (weight) of these effective food sources, a weighted average of their trophic levels is calculated. The consumer's trophic level is this weighted average plus 1. If the consumer's trophic level is being calculated for the first time, it is directly assigned a value; if it is being updated, the difference between the old and new values is calculated. If the difference is greater than a preset tolerance, an update is performed and the change is recorded. When an iteration ends, if no updates have occurred, it is considered converged, and the iteration stops.
[0094] The fourth step is to apply ecological constraints. All calculated trophic levels are checked, and if any value is less than 1.0, it is forcibly corrected to 1.0 to ensure the results conform to ecological definitions.
[0095] The fifth step is verification and adjustment. The calculated trophic level relationships are mapped back to the original diet matrix, and any logical conflicts are checked, such as consumers having trophic levels lower than or equal to the trophic levels of their food sources. If conflicts are found, the illogical relationships are eliminated by fine-tuning the trophic levels of the relevant species.
[0096] Ultimately, the algorithm outputs a dictionary containing trophic levels for all species, providing a foundation for subsequent network analysis and visualization.
[0097] To comprehensively analyze the characteristics of ecosystems at different spatiotemporal scales, this invention also provides a multi-dimensional hierarchical analysis engine. This engine can automatically segment the data according to different dimensions and perform food web model analysis separately, based on the same set of fundamental data.
[0098] The multi-dimensional hierarchical analysis engine takes as input cleaned species isotope and biomass data tables, a diet matrix, and biomass data. The execution steps are as follows: The first step is to initialize an empty results dictionary to store all analysis results.
[0099] The second step is to perform a global analysis. Using all the data, the core function of the food web model analysis is called to perform a global analysis of the entire study area, and the results are stored under the "global" key of the dictionary.
[0100] The third step is to determine whether the data table contains a "watershed" field. If it does, retrieve all unique watershed names. For each watershed, filter out a subset of data belonging to that watershed from the total data, and perform a food web model analysis on that subset independently. Store the analysis results in a results dictionary with the key "watershed_[watershed name]".
[0101] The fourth step is to determine if the data table contains a "river" field. If it does, retrieve all unique river names. For each river, filter the data, perform a food web model analysis, and store the results in a results dictionary with the key "river_[river name]".
[0102] The fifth step is to determine if the data table contains a "Year" field. If it does, retrieve all unique years. For each year, filter the data, perform a food web model analysis, and store the results in a results dictionary with the key "Year_[Year]".
[0103] Step 6: Perform combined dimensional analysis. The engine supports multi-dimensional cross-analysis, such as "basin" and "year". If the data contains both of these fields, it iterates through all combinations of basins and years, performs food web model analysis on each subset of data (e.g., "basin A_2020"), and stores the results in the results dictionary with the corresponding combination name.
[0104] Step 7: Generate a summary report. After the analysis of all dimensions is completed, the engine will automatically summarize all results, generate a comprehensive data table, and automatically generate visualization charts for comparative analysis based on this table.
[0105] Ultimately, the algorithm returns a comprehensive dictionary containing multi-dimensional analysis results, providing data support for researchers to reveal the evolutionary patterns of ecosystems at different spatiotemporal scales.
[0106] This invention also provides a visual layout algorithm for trophic level constraints: To make the layout of food web diagrams more intuitively reflect ecological significance, this invention proposes a force-directed layout algorithm constrained by trophic levels. This algorithm, based on the classic force-directed layout, introduces trophic levels as a strong constraint on the vertical position of nodes.
[0107] The visual layout algorithm for trophic level constraints takes as input a network graph (G) of the food web structure to be drawn and a dictionary of trophic levels for each node. The steps for calculating the final coordinates of the nodes are as follows: The first step is to calculate the trophic level range. Iterate through the trophic levels of all nodes and find the minimum and maximum values.
[0108] The second step is to group by trophic level. All nodes are grouped according to their trophic level values, with nodes at the same trophic level being grouped together.
[0109] The third step is initial position allocation. All trophic level values are sorted. For each trophic level group, the Y-axis coordinate of the nodes is determined based on their trophic level values; the higher the trophic level, the larger the Y-axis coordinate, thus initially forming a trophic pyramid in the vertical direction. Within the same trophic level, nodes are evenly distributed along the X-axis to avoid initial overlap.
[0110] Step four: Perform constrained force-directed optimization. Within a set number of iterations, repeatedly perform the following operations: Calculate and apply the repulsive forces between nodes to disperse the nodes; Calculate and apply the attraction between nodes connected by edges to bring the connected nodes closer together; After each iteration, a Y-axis coordinate constraint is enforced. For each node, its current Y-axis coordinate is reset to the theoretical Y-coordinate calculated based on its trophic level (or within a very small range around it). This step ensures that while optimizing the aesthetics of the layout, the node's position in the vertical direction always faithfully reflects its trophic level.
[0111] After the above iterative optimization, the algorithm finally outputs a dictionary of node coordinates (pos) that satisfies the vertical constraints of trophic levels and has few edge intersections, which can be used to draw a clear and accurate ecological trophic level network diagram.
[0112] This invention also provides a comprehensive method for calculating ecosystem indicators, which can be used to quantitatively assess the structure and function of food webs from multiple dimensions.
[0113] The method for calculating ecosystem metrics takes a constructed food web graph (G), a trophic level dictionary (trophic_levels), and an omnivorousness index dictionary (ois) as input, and calculates the output ecosystem metric dictionary through the following steps: The first step is to calculate network structure metrics, including: Species richness, which is the total number of nodes in the network graph; Number of connections, i.e., the total number of edges in the network graph; Connection density, which is the ratio of the actual number of connections to the theoretically maximum possible number of connections, reflects the complexity of the network.
[0114] The second step is to calculate the trophic level structure indices. Based on the trophic level dictionary, the following indices are calculated: Average trophic level reflects the overall trophic position of the system; The highest trophic level, which is the length of the food chain; Trophic level diversity, or the standard deviation of trophic levels, reflects the vertical complexity of trophic structure. Trophic level distribution refers to the distribution of species numbers at different integer trophic levels.
[0115] The third step is to calculate the omnivorousness index. Based on the weighted omnivorousness index dictionary, the following index is calculated: The average omnivorousness index reflects the average level of omnivorousness among species within an ecosystem; The proportion of highly omnivorous species, i.e., the proportion of species with an omnivorous index above a certain threshold (such as 0.5), can be used to measure the connectivity redundancy of a food web and its functional stability in response to disturbances.
[0116] The fourth step is to identify key species. Species crucial to network structure are identified through a comprehensive scoring system of multiple centrality indicators, including: Calculate the betweenness centrality of each node to measure its importance as a bridge in the network; Calculate the degree centrality of each node to measure the extent to which it is directly connected to other species; The criticality score is calculated by weighting betweenness centrality and degree centrality with certain weights (e.g., 0.5 and 0.3). Simultaneously, considering that species changes at higher trophic levels may have a more profound impact on the ecosystem, a trophic level factor is introduced to correct the score; that is, the score is multiplied by a coefficient positively correlated with trophic level (e.g., 1 + 0.2 × normalized trophic level). Ultimately, each species receives a comprehensive criticality score; the higher the score, the more critical it is in maintaining the structural and functional stability of the food web.
[0117] Ultimately, the method returns a dictionary containing all the above indicators, providing a quantitative basis for assessing the health status of the ecosystem, monitoring restoration effectiveness, and making management decisions.
[0118] The food web construction method provided in this embodiment constructs a closed loop of "quantitative-iterative-intelligent" food web construction. It achieves quantitative identification of dietary relationships through isotopic features, providing accurate input for subsequent analysis; it automatically filters core food relationships through iterative optimization of the Bayesian model, solving the problems of data noise and static models; and it realizes automated evaluation of food web functions by proposing new indicators such as the "weighted omnivorousness index." These three technical features are interconnected, jointly solving the technical problems of "one-time calculation, lack of optimization, and superficial analysis," achieving a technological leap from "structural analysis" to "intelligent construction and functional evaluation."
[0119] This embodiment also provides a food web construction apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0120] This embodiment provides a food web construction device, such as... Figure 4 As shown, it includes: The data acquisition module 401 is used to acquire carbon and nitrogen stable isotope data of biological samples from the area to be analyzed.
[0121] The diet matrix generation module 402 is used to identify the diet relationships between consumers and potential food sources based on carbon and nitrogen stable isotope data, and to generate an initial diet matrix.
[0122] The matrix optimization module 403 is used to iteratively optimize the diet relationships in the initial diet matrix based on a pre-built Bayesian mixture model, and generate an optimized diet matrix.
[0123] Food web construction module 404 is used to construct a food web structure that reflects the energy flow relationship between species based on the optimized diet matrix.
[0124] In some alternative implementations, the diet matrix generation module 402 includes: Sample attribute partitioning units are used to classify biological samples into consumers and potential food sources based on ecological labels or cluster analysis results.
[0125] The food relationship identification unit is used to identify the food relationship between consumers and potential food sources in a pre-constructed two-dimensional isotope space based on carbon and nitrogen stable isotope data.
[0126] The diet matrix construction unit is used to generate an initial diet matrix with consumers as rows, potential food sources as columns, and diet relationships as matrix elements.
[0127] In some alternative implementations, carbon and nitrogen stable isotope data include: a first isotope and a second isotope; the two-dimensional isotope space is constructed in the following manner: A two-dimensional isotope space is constructed with the first isotope as the vertical axis and the second isotope as the horizontal axis.
[0128] In some optional implementations, the diet relationship identification unit includes: The data mapping subunit is used to map the first and second isotopes of consumers, as well as the first and second isotopes of potential food sources, as data points into a two-dimensional isotope space.
[0129] The computational subunit is used to analyze the distribution characteristics of each data point in two-dimensional isotopic space and calculate the spatial distance or overlap between consumers and potential food sources.
[0130] The collaborative screening subunit is used to perform dual isotope collaborative screening of the spatial relationship between consumers and potential food sources based on the nutritional location indication function of the first isotope and the food source indication function of the second isotope.
[0131] The diet relationship identification subunit is used to identify potential predator-prey relationships as diet relationships between consumers and potential food sources in a two-dimensional isotopic space, based on the spatial distance or overlap between consumers and potential food sources, and the results of dual isotope collaborative preliminary screening.
[0132] In some alternative implementations, the matrix optimization module 403 includes: The contribution ratio mean calculation unit is used to solve the pre-built Bayesian mixture model using a random sampling method, obtain the posterior distribution of the contribution ratio of each potential food source, and calculate the mean contribution ratio.
[0133] The threshold filtering unit is used to compare the average contribution ratio with a preset threshold and remove potential food source connections whose average contribution ratio is lower than the preset threshold.
[0134] The normalization unit is used to renormalize the proportion of potential food source contributions retained.
[0135] The iterative optimization unit is used to repeatedly execute the Bayesian mixture model solution, comparison and normalization steps until the connections of the eliminated potential food sources no longer change or the preset number of iterations is reached, generating an optimized diet matrix.
[0136] In some alternative implementations, the contribution ratio is the parameter to be estimated, and the Dirichlet prior distribution is determined. Based on the average carbon and nitrogen stable isotope values and contribution ratios of each potential food source, the expected value of the carbon and nitrogen stable isotope ratio for consumers is calculated by correcting with a nutrient enrichment factor. Based on the difference between the measured and expected values of the carbon-nitrogen stable isotope ratio of consumers, a normal likelihood function is constructed. The normal likelihood function is used to characterize that the measured value follows a normal distribution with the expected value as the mean and the preset variance as the variance. By combining the Dirichlet prior distribution with the normal likelihood function using Bayes' theorem, a posterior distribution of the contribution ratio is constructed, resulting in a Bayesian mixture model.
[0137] In some alternative implementations, the food web building module 404 includes: The network structure element determination unit is used to extract all consumers and all potential food sources as nodes from the optimized diet matrix, and to use diet relationships with a contribution ratio greater than zero as directed edges connecting consumers and food sources, with the corresponding contribution ratio as the weight of the edge.
[0138] Food web building blocks are used to construct directed graphs representing the direction of energy flow between species, based on nodes and directed edges, as the structure of a food web.
[0139] In some alternative embodiments, the device further includes: The weighted omnivorousness index calculation module is used to calculate the weighted omnivorousness index based on the food web structure and the optimized diet matrix, in order to quantitatively evaluate the functional stability of the food web structure. The weighted omnivorousness index is calculated using the following formula: ; in, Indicates the weighted omnivorousness index. The proportion of contribution to potential food sources, For weighted average trophic level, Nutritional level for potential food sources.
[0140] In some alternative embodiments, the device further includes: The trophic level calculation module is used to automatically identify the baseline species with a preset trophic level based on carbon and nitrogen stable isotope data or food web structure, and assign a baseline trophic level to the baseline species; based on the optimized diet matrix, iteratively calculates the trophic levels of all species until the trophic levels of all species converge; the trophic levels of all species include consumer trophic levels and potential food source trophic levels, wherein each consumer trophic level is the weighted average of all corresponding potential food source trophic levels plus a preset value; the calculation results of trophic levels are checked and corrected so that each consumer trophic level is higher than the corresponding potential food source trophic level, and the trophic level of all species is not lower than the baseline trophic level.
[0141] The food web construction apparatus provided in this embodiment of the invention can execute the food web construction method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0142] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0143] The following is a detailed reference. Figure 5 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from memory 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device. The processor 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0144] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0145] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a memory 508, or installed from a ROM 502. When the computer program is executed by the processor 501, it performs the functions defined in the food web construction method of the embodiments of the present invention.
[0146] Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of the present invention.
[0147] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the food web construction method shown in the above embodiments is implemented.
[0148] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0149] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for constructing a food web, characterized in that, The method includes: Obtain stable carbon and nitrogen isotope data from biological samples in the region to be analyzed; Based on the carbon and nitrogen stable isotope data, the dietary relationships between consumers and potential food sources are identified, and an initial dietary matrix is generated. Based on a pre-built Bayesian mixture model, the diet relationships in the initial diet matrix are iteratively optimized to generate an optimized diet matrix. Based on the optimized diet matrix, a food web structure reflecting the energy flow relationships between species is constructed.
2. The method according to claim 1, characterized in that, The process of identifying dietary relationships between consumers and potential food sources based on the carbon and nitrogen stable isotope data, and generating an initial dietary matrix, includes: Based on the ecological tags or cluster analysis results of biological samples, biological samples are classified into consumers and potential food sources. Based on the carbon and nitrogen stable isotope data, dietary relationships between consumers and potential food sources are identified in a pre-constructed two-dimensional isotope space. An initial diet matrix is generated using the consumers as rows, the potential food sources as columns, and the diet relationships as matrix elements.
3. The method according to claim 2, characterized in that, The carbon and nitrogen stable isotope data includes: a first isotope and a second isotope; the two-dimensional isotope space is constructed in the following manner: A two-dimensional isotope space is constructed with the first isotope as the vertical axis and the second isotope as the horizontal axis.
4. The method according to claim 2, characterized in that, Based on the aforementioned carbon and nitrogen stable isotope data, dietary relationships between consumers and potential food sources are identified in a pre-constructed two-dimensional isotope space, including: The first and second isotopes of consumers, as well as the first and second isotopes of potential food sources, are used as data points and mapped to the two-dimensional isotope space. Analyze the distribution characteristics of each data point in two-dimensional isotope space to calculate the spatial distance or overlap between consumers and potential food sources; Based on the nutritional location indication function of the first isotope and the food source indication function of the second isotope, a dual isotope synergistic screening is conducted to determine the spatial relationship between consumers and potential food sources. In the two-dimensional isotope space, based on the spatial distance or overlap between consumers and potential food sources, and the results of dual isotope synergistic screening, potential predator-prey relationships are identified as dietary relationships between consumers and potential food sources.
5. The method according to claim 1, characterized in that, The method, based on a pre-built Bayesian mixture model, iteratively optimizes the feeding relationships in the initial feeding matrix to generate an optimized feeding matrix, including: The pre-constructed Bayesian mixture model is solved using a random sampling method to obtain the posterior distribution of the contribution ratio of each potential food source, and the mean contribution ratio is calculated. The average contribution ratio is compared with a preset threshold, and potential food source connections with an average contribution ratio lower than the preset threshold are eliminated. The contribution ratio of retained potential food sources was renormalized. Repeat the steps of solving, comparing, and normalizing the Bayesian mixture model until the connections of the eliminated potential food sources no longer change or the preset number of iterations is reached, and generate the optimized diet matrix.
6. The method according to claim 5, characterized in that, The Bayesian mixture model is constructed in the following manner: The Dirichlet prior distribution is determined by using the proportion of each potential food source to consumers as the parameter to be estimated. Based on the average carbon and nitrogen stable isotope values and contribution ratios of each potential food source, the expected value of the carbon and nitrogen stable isotope ratio for consumers is calculated by correcting with a nutrient enrichment factor. Based on the difference between the measured value and the expected value of the carbon-nitrogen stable isotope ratio of consumers, a normal likelihood function is constructed. The normal likelihood function is used to characterize that the measured value follows a normal distribution with the expected value as the mean and the preset variance as the variance. By combining the Dirichlet prior distribution with the normal likelihood function using Bayes' theorem, a posterior distribution of the contribution ratio is constructed, resulting in a Bayesian mixture model.
7. The method according to claim 1, characterized in that, The construction of a food web structure reflecting energy flow relationships among species based on the optimized diet matrix includes: Extract all consumers and all potential food sources as nodes from the optimized diet matrix, and use diet relationships with a contribution ratio greater than zero as directed edges connecting consumers and food sources, with the corresponding contribution ratio as the weight of the edge. Based on the nodes and the directed edges, a directed graph representing the direction of energy flow between species is constructed as the food web structure.
8. The method according to claim 1, characterized in that, The method further includes: Based on the food web structure and the optimized diet matrix, a weighted omnivorousness index is calculated to quantitatively evaluate the functional stability of the food web structure. The weighted omnivorousness index is calculated using the following formula: ; in, Indicates the weighted omnivorousness index. The proportion of contribution to potential food sources, For weighted average trophic level, Nutritional level for potential food sources.
9. The method according to claim 1, characterized in that, The method further includes: Based on the carbon and nitrogen stable isotope data or food web structure, a benchmark species with a preset trophic level is automatically identified, and a benchmark trophic level is assigned to the benchmark species. Based on the optimized diet matrix, the trophic level of all species is calculated iteratively until the trophic level of all species converges. The trophic level of all species includes the consumer trophic level and the potential food source trophic level. Each consumer trophic level is the weighted average of all potential food source trophic levels plus a preset value. The trophic level calculations were checked and corrected so that each consumer’s trophic level was higher than the corresponding potential food source’s trophic level, and all species’ trophic levels were not lower than the baseline trophic level.
10. A food web construction device, characterized in that, The device includes: The data acquisition module is used to acquire stable carbon and nitrogen isotope data of biological samples from the area to be analyzed. The diet matrix generation module is used to identify the diet relationships between consumers and potential food sources based on the carbon and nitrogen stable isotope data, and to generate an initial diet matrix. The matrix optimization module is used to iteratively optimize the feeding relationships in the initial feeding matrix based on a pre-built Bayesian mixture model, and generate an optimized feeding matrix. The food web construction module is used to construct a food web structure that reflects the energy flow relationships between species based on the optimized diet matrix.