Bacterial coexistence driven by motility and spatial competition-模型代码

一、说明

  • 本文主要对文献《Bacterial coexistence driven by motility and spatial competition》使用的代码模型进行注释分享。
    - [1] Gude S , Pine E , Taute K M , et al. Bacterial coexistence driven by motility and spatial competition[J]. Nature, 2020.
  • 代码来源于向原作者邮件获取。

二、模型简介

  • 文章中的模型采用空间扩散和Mond结合建立描述大肠杆菌在固体平面的竞争关系。
    -运行环境 matlab 2020b

三、模型建立过程

  • 待续
  • ∂p1∂t=r−1∂∂r(rnK+n(D1∂p1∂r−χ1p1∂n∂r))+ln2nK+nμ1p1\frac{\partial {p}_{1}}{\partial t}={r}^{-1}\frac{\partial }{\partial r}\left(r\frac{n}{K+n}\left({D}_{1}\frac{\partial {p}_{1}}{\partial r}-{\chi }_{1}{p}_{1}\frac{\partial n}{\partial r}\right)\right)+\,\mathrm{ln}\,2\frac{n}{K+n}{\mu }_{1}{p}_{1} ∂t∂p1​​=r−1∂r∂​(rK+nn​(D1​∂r∂p1​​−χ1​p1​∂r∂n​))+ln2K+nn​μ1​p1​
    ∂p1∂t=r−1∂∂r(rnK+n(D1∂p1∂r−χ1p1∂n∂r))+ln2nK+nμ1p1\frac{\partial {p}_{1}}{\partial t}={r}^{-1}\frac{\partial }{\partial r}\left(r\frac{n}{K+n}\left({D}_{1}\frac{\partial {p}_{1}}{\partial r}-{\chi }_{1}{p}_{1}\frac{\partial n}{\partial r}\right)\right)+\,\mathrm{ln}\,2\frac{n}{K+n}{\mu }_{1}{p}_{1} ∂t∂p1​​=r−1∂r∂​(rK+nn​(D1​∂r∂p1​​−χ1​p1​∂r∂n​))+ln2K+nn​μ1​p1​
    ∂n∂t=r−1∂∂r(rDn∂n∂r)−ln2nK+n(μ1p1+μ2p2)\frac{\partial n}{\partial t}={r}^{-1}\frac{\partial }{\partial r}\left(r{D}_{n}\frac{\partial n}{\partial r}\right)-\,\mathrm{ln}\,2\frac{n}{K+n}({\mu }_{1}{p}_{1}+{\mu }_{2}{p}_{2}) ∂t∂n​=r−1∂r∂​(rDn​∂r∂n​)−ln2K+nn​(μ1​p1​+μ2​p2​)

四、源码

  • 主函数
%% define parameters
growthRates = [0.404; 0.47]; % db/h
kMonods = [1e-3; 1e-3]; % a.u.
diffusionCoefficients = [0.02; 0.02; 1.8]; % mm^2/h
chis = [0.875; 0.0]; % mm^2/(h a.u.)
lambdas = [10; 10]; % 1/mm
plateauWidths = [1.0; 1.0]; % mm
uMaxs = [0.5e-3; 0.5e-3; 1e0]; % a.u.xmesh = 0:0.1:17.5; % mm
tspan = 0:0.01:4*24; % hoursspeciesNames = {'A', 'B', 'Nutrient'};%% numerically solve system
solution = competition(growthRates, kMonods, diffusionCoefficients, chis, lambdas, uMaxs, plateauWidths, xmesh, tspan);%% display final population ratio and change in population ratio
disp(strcat('Final Ratio (B/A)=', num2str((sum(solution(end,:,2).*xmesh) ./ sum(solution(end,:,1).*xmesh)))));
disp(strcat('Change Ratio =', num2str((sum(solution(end,:,2).*xmesh) ./ sum(solution(end,:,1).*xmesh)) ./ (sum(solution(1,:,2).*xmesh) ./ sum(solution(1,:,1).*xmesh)))));%% visualize solution (A, B and nutrient)
for i=1:size(solution,3)% figure dimensionsh_fig = figure;set(h_fig, 'PaperUnits','centimeters');set(h_fig, 'PaperPosition', [0 0 4.5 4.5]);% actual plottingimagesc(solution(:,:,i)');% axis, labels, ...set(gca, 'FontSize', 9);title(speciesNames{i});xlabel('Time [d]');ylabel('Expansion [mm]');set(gca, 'XTick', 0:2400:length(tspan));set(gca, 'XTickLabel', tspan(1):1:tspan(end)/24);set(gca, 'YTick', 1:50:2001);set(gca, 'YTickLabel', 0:5:200);set(gca,'YDir','normal');axis([1 length(tspan) 1 length(xmesh)]);caxis([0 4.25]);colormap(h_fig, 'jet');%print(h_fig, '-depsc2', strcat('TODO', speciesNames{i}, '.eps'));
end% report amount of nutrients left over at the end of the simulation
disp(strcat('Fraction of nutrients present at the end:', num2str(calculateTotalAmount(solution(end,:,3), xmesh) / calculateTotalAmount(solution(1,:,3), xmesh)), 'a.u.'));
clear
  • 模型方程
function solution = competition( growthRates, kMonods, diffusionCoefficients, chis, lambdas, uMaxs, plateauWidths, xmesh, tspan )% symmetry of the systemm = 1;% numerically solve pdessolution = pdepe(m, @(x,t,u,DuDx)pdefun(x,t,u,DuDx,growthRates,kMonods,diffusionCoefficients,chis), @(x)icfun(x,lambdas,uMaxs,plateauWidths), @bcfun, xmesh, tspan);
end%% Keller-Segel model and diffusion + consumption of nutrient
function [c,f,s] = pdefun(x,t,u,DuDx,growthRates,kMonods,diffusionCoefficients,chis)c = [1; 1; 1];f = [(u(3)./(kMonods(1)+u(3))).*(diffusionCoefficients(1) .* DuDx(1) - chis(1) .* u(1) .* DuDx(3)); (u(3)./(kMonods(2)+u(3))).*(diffusionCoefficients(2) .* DuDx(2) - chis(2) .* u(2) .* DuDx(3)); diffusionCoefficients(3) .* DuDx(3)];s = [(u(3)./(kMonods(1)+u(3))).*log(2).*growthRates(1).*u(1); (u(3)./(kMonods(2)+u(3))).*log(2).*growthRates(2).*u(2); -(log(2).*growthRates(1).*u(1).*(u(3)./(kMonods(1)+u(3))) + log(2).*growthRates(2).*u(2).*(u(3)./(kMonods(2)+u(3))))];
end%% exponentially decaying initial profile
function u0 = icfun(x, lambdas, uMaxs, plateauWidths)u0 = [uMaxs(1).*exp(-lambdas(1).*(x-plateauWidths(1))); uMaxs(2).*exp(-lambdas(2).*(x-plateauWidths(2))); uMaxs(3).*ones(size(x))];u0(1, 1:find(x<=plateauWidths(1), 1, 'last')) = uMaxs(1);u0(2, 1:find(x<=plateauWidths(2), 1, 'last')) = uMaxs(2);
end%% no flux boundary contitions on both sides
function [pl,ql,pr,qr] = bcfun(xl,ul,xr,ur,t)pl = [0; 0; 0];ql = [1; 1; 1];pr = [0; 0; 0];qr = [1; 1; 1];
end
  • 其他
function totalAmount = calculateTotalAmount( u , xmesh )totalAmount = u * xmesh';end

五、文献解读

  • 待续

文献--Bacterial coexistence driven by motility and spatial competition-模型代码相关推荐

  1. python中tree 100 6_Python spatial.KDTree方法代码示例

    本文整理汇总了Python中scipy.spatial.KDTree方法的典型用法代码示例.如果您正苦于以下问题:Python spatial.KDTree方法的具体用法?Python spatial ...

  2. 文献记录(part52)--基于度相关性的病毒传播模型及其分析

    学习笔记,仅供参考,有错必纠 关键词:互联网拓扑:度相关性:病毒传播:DPR 算法:SIS-DVDI: 基于度相关性的病毒传播模型及其分析 摘要 近年来网络病毒传播已对网络安全构成严重威胁 . 研究表 ...

  3. 人脑与计算机类比文献,人脑计算机接口基于隐马科夫模型的思维运动异步分类...

    摘要: 近年来,人脑计算机接口(Brain-Computer Interface)技术在生理学和信息学研究的基础上不断取得进展.BCI技术的发展以及成功运用将会给人类社会带来巨大的便利.本文通过对人脑 ...

  4. Nature:运动能力与空间竞争驱动的细菌共存及机制解析

    Bacterial coexistence driven by motility and spatial competition DOI:https://doi.org/10.1038/s41586- ...

  5. 新冠疫情预测模型--逻辑斯蒂回归拟合、SEIR模型

     """ 一个不知名大学生,江湖人称菜狗 original author: jacky Li Email : 3435673055@qq.com Last edited: ...

  6. 本周最新文献速递20211212

    本周最新文献速递20211212 一.精细解读文献 一 文献题目: Common and rare variant association analyses in amyotrophic latera ...

  7. 详细解读Spatial Transformer Networks(STN)-一篇文章让你完全理解STN了

    Spatial Transformer Networks https://blog.jiangzhenyu.xyz/2018/10/06/Spatial-Transformer-Networks/ 2 ...

  8. OCCI读写Oracle Spatial的SDO_Geometry

    1.使用Oracle OTT工具生成对应的C++类. 1.1设置ORACLE_HOME:服务器端安装目录. 设置客户端安装目录,提示什么java错误. 暂时不管了. 1.2写一个intype文件tes ...

  9. 基于多传感器数据融合的全自动泊车系统研究与应用(文献综述)

    附:文献综述 基于多传感器数据融合的全自动泊车系统研究与应用 摘要: 随着科技的进步与城市车位空间的减小,汽车逐渐向智能化发展,如何安全快速地泊车成为驾驶员面临的难题.关于自动泊车辅助系统的研究,国内 ...

最新文章

  1. 一个 Vue + Node + MongoDB 博客系统
  2. 使用plsql developer 创建用户
  3. Linux应用程序和驱动程序如何完成交互,应用程序和驱动的简易交互方式的实现...
  4. 性能优化:MySQL 性能提升之降龙十八掌
  5. sql数据库批量插入
  6. Activiti6新特性
  7. 人体颈椎神经分布图高清,颈椎部神经分布图高清
  8. 字节、字位、千字节、兆字节、吉字节等概念
  9. 使用discuz搭建bbs论坛网站
  10. 自带的richedit控件显示图片文字(仿QQ聊天内容文字图片)
  11. 六足机器人步态与动力学仿真
  12. 来自华为员工家属的“抱怨”
  13. 3)数据科学的数学之序列与极限--阶乘/指数增长比较
  14. 单窗口单ip技术是什么
  15. 三菱 plc远程调试及上下载方法
  16. Docker 安装 命令 数据卷 应用部署 网络优化 Dockerfile 服务编排Compose 私有仓库
  17. 欧盟委员会将批准微软收购Skype的交易
  18. 三只松鼠、盐津铺子:战略相似,命运迥异
  19. 「杀毒」卡巴斯基 5.0.388 单机简体中文专业版
  20. 天太冷导致电脑无法开机,怎么解决?

热门文章

  1. 解决极值中的神奇设k法_神奇宝贝Go拥有对您的Google帐户的完全访问权限。 这是解决方法[更新]...
  2. 2022年湖南省高职单招(语文)考试冲刺试题及答案
  3. 技术小品文(一)字符串放在哪里?
  4. 【这些题我一拿到手就会】C指针和数组试题详解(上)
  5. 几种蔬菜帮你降糖 血糖过高的人别错过
  6. c语言反应能力的手机游戏,锻炼反应能力的游戏合集
  7. 用win10怎么练计算机一级,你真的懂Win10吗?升Win10后必做的9件事
  8. 赤手空拳如何成就百万富翁?——网络营销之七(第四招:百度文库+QQ群)
  9. 三星I939D手机刷机记录
  10. 小程序日历控件分享 按月传值显示