Package: polaritymodel
This is a pip-installable package containing all the code needed to run the cell polarity model, with all the modifications I've made of it.Code (the bulk ofpolarcore.py) comes from this repo:https://github.com/juliusbierk/polar. Prior work on this model can be found in these publications:Nissen, S. B., Perera, M., Gonzalez, J. M., Morgani, S. M., Jensen, M. H., Sneppen, K., Brickman, J. M., & Trusina, A. (2017). Four simple rules that are sufficient to generate the mammalian blastocyst. PLoS Biology, 15(7), 1–30.https://doi.org/10.1371/journal.pbio.2000737Nissen, S. B., Rønhild, S., Trusina, A., & Sneppen, K. (2018). Theoretical tool bridging cell polarities with development of robust morphologies. ELife, 7, 1–25.https://doi.org/10.7554/eLife.38407Kirkegaard, J. B., Nielsen, B. F., Trusina, A., & Sneppen, K. (2019). Self-assembly, buckling and density-invariant growth of three-dimensional vascular networks. Journal of The Royal Society Interface, 16(159), 20190517.https://doi.org/10.1098/rsif.2019.0517Nielsen, B. F., Nissen, S. B., Sneppen, K., Mathiesen, J., & Trusina, A. (2020). Model to Link Cell Shape and Polarity with Organogenesis. IScience, 23(2), 100830.https://doi.org/10.1016/j.isci.2020.100830What this code does differently to what came before is to incorporate the effects of WNT expression on the orientation of planar cell polarity (PCP). WNT is a protein that has been observed to be important in organ formation, and in particular the formation of branched structures such as in the kidney, the lung, and salivary glands. We hypothesize that gradients of WNT expression act to orient PCP cyclically, promoting the formation and branching of stable tubular structures. Prior work has considered a two-dimensional model of organ formation, without PCP. We argue that PCP is key to understanding the role of WNT in branching for three-dimensional organs.InstallationTo download and install this package, you can do:Navigate to an empty folderRungh repo clone jasnyder/polarpkgRunpython3 -m pip install .You can pass the-eflag to pip (i.e. runpython3 -m pip install -e .), which will install the package in "editable" mode. This means that you can make changes to the source code and these changes will be immediately reflected in the code's behavior, without having to re-runpip install.This should install the package. You should then be able to import it in Python by doingimportpolaritymodelThere is a version of this package onPyPI, at which can be installed by simply runningpython3 -m pip install polaritymodelYou can view the PyPI versionhereRequirementsThe code relies essentially ontorchfor the heavy lifitng of the simulation, and benefits greatly from usage of a GPU. If your system does not support CUDA, be sure to run the code with thedevice='cpu'keyword (passed on creation of aPolar,PolarWNT, orPolarPDEobject).numpyis needed, as well asscipymainly for itsKDTreeroutine. Plotting is done withplotlywhich interacts with data viapandasDataFrames.pickleis used for data read/write.UsageThe basic usage of the code will look something like thisfrompolaritymodelimportPolarPDE,potentials_wntx,p,q=initial_conditions()beta=eta=lam=yield_every=# set other paramstimesteps=10yield_every=10000# create simulation objectsim=PolarPDE(x,p,q,beta,eta,lam,yield_every)potential=potentials_wnt.potential_nematic_reweightrunner=sim.simulation(potential,timesteps,yield_every)forlineinitertools.islice(runner,timesteps):withopen('path/to/data/file.pkl','wb')asfobj:pkl.dump(line,fobj)PlottingPlotting is done via utilities in theplotsubpackage. Theplotsubpackage has a core set of functions located in the moduleplotcore, and there are other modules to make different types of visualizations, such as 3D animations, heatmaps of ligand density, and PCP vector fields. These can be accessed from within a python script, such asfrompolaritymodel.plot.plotcoreimportload,build_df,selectfrompolaritymodel.plot.cones_wnt_ligandimportplot,save...or alternatively from the command line, as such:python3 -m polaritymodel.plot.cones_wntafter which you will receive command-line prompts for the filename of the data set you wish to plot, and other relevant options.