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. 从docker 中抓取jvm heap 信息, 并且分析
  2. Codeforces Gym101257F:Islands II(求割点+思维)
  3. java用流体加减乘除_任意输入两个数,完成加法、减法、乘法、除法运算!(加减乘除运算分别定义四个方法)_学小易找答案...
  4. MySQL数据库:读写分离
  5. 小试用python搭建自己的web服务器
  6. 45K!拿下 AI 技术岗,这些知识点全考了!
  7. Linux下bash:command not found提示
  8. 第一段VBA脚本留念
  9. C++(多态实现原理)函数重写,重载,重定义
  10. java调用百度api进行身份证识别
  11. [MS-SHLLINK]: Shell Link (.LNK) Binary File Format
  12. php加skplayer,WordPress整合ckplayer(最新)
  13. python概述ppt_江红-第1章-Python概述ppt
  14. 静态路由只配置出接口网络不通(实验)
  15. Chrome漏洞分析与利用(三)——Issue-1062091漏洞分析
  16. 3.3KW车载充电机开关电源方案数字控制单相PFC与全桥LLC
  17. [转]免费接口API
  18. 移动端网页禁止下拉刷新css
  19. 红旗7linux安装教程,红旗Linux7.0硬盘安装简明教程
  20. 【并发编程】(学习笔记-共享模型之管程)-part3

热门文章

  1. androidnbsp;强大的adbnbsp;测试工具
  2. linux 卸载nexus,CentOS7安装Nexus
  3. iOS Facebook第三方登录
  4. 引用dubbo服务时的ref和id分别是什么
  5. openofdm中complex_to_mag的分析
  6. 韩KakaoPay移动支付系统问世 仅支持安卓用户
  7. kali字体设置-各种字体图标大小调整总结
  8. layabox使用Animation创作一个简单的动画
  9. PHP文字转语音排号声音_百度文字转语音免费接口使用实例
  10. java图片裁剪类似qq头像_Android实现类似换QQ头像功能(图片裁剪)