├── .gitattributes ├── .gitignore ├── CDMetaPOP_v2.73.zip ├── CDMetaPOP_v2.74.zip ├── CDMetaPOP_v2.75.zip ├── CDMetaPOP_v2.76.zip ├── README.md ├── doc ├── .$FlowDiagrams.drawio.bkp ├── CDmetaPOPhistory.txt ├── FlowDiagrams.Immigration_v0.png ├── FlowDiagrams.Immigration_v1.png ├── FlowDiagrams.drawio ├── README.txt ├── cdmetapop2_usermanual.docx └── disclaimer_cdmetapop.txt ├── example_files ├── RunVars.csv ├── RunVars_AddFyy.csv ├── RunVars_AddMyy.csv ├── RunVars_multispecies.csv ├── cdmats │ ├── Patch7_CdmatrixS1.csv │ ├── Patch7_CdmatrixS1_Barriers.csv │ ├── Patch7_CdmatrixS2.csv │ ├── Patch7_Probmatrix.csv │ ├── Patch7_Probmatrix_Dispersal.csv │ ├── Patch7_Probmatrix_onewayBarriers.csv │ ├── Patch7_Probmatrix_onewayBarriersXRiverineS1.csv │ └── Patch7_Probmatrix_onewayBarriersXRiverineS2.csv ├── classvars │ ├── ClassVars_AS1.csv │ ├── ClassVars_AS2.csv │ ├── ClassVars_AddFYY.csv │ ├── ClassVars_AddYY.csv │ ├── ClassVars_StartFYY.csv │ ├── ClassVars_StartYY.csv │ ├── ClassVars_anadromy.csv │ └── ClassVars_bat.csv ├── genes │ ├── allelefrequencyA.csv │ ├── allelefrequencyAS1.csv │ ├── allelefrequencyAS2.csv │ ├── allelefrequencyB.csv │ ├── allelefrequencyBT.csv │ ├── allelefrequencyC.csv │ ├── allelefrequencyD.csv │ ├── allelefrequencyDV.csv │ ├── allelefrequencyInitVar.csv │ ├── allelefrequencyTime1.csv │ ├── wildtype_hindex1.csv │ └── yytype_hindex0.csv ├── otherfiles │ ├── 3popmort_PhaseI.csv │ ├── 3popmort_PhaseII.csv │ ├── Patch_r.csv │ └── betafiles │ │ ├── Appendix2_betaFile_General.xlsx │ │ └── betaFile_3X3L2A.csv ├── patchvars │ ├── PatchVars.csv │ ├── PatchVarsS1.csv │ ├── PatchVarsS2.csv │ ├── PatchVarsS3.csv │ ├── PatchVars_AddFyy.csv │ ├── PatchVars_AddMyy.csv │ ├── PatchVars_IntroducePopulation.csv │ ├── PatchVars_MultiClassVars.csv │ ├── PatchVars_MultiLocus.csv │ ├── PatchVars_X3.csv │ ├── PatchVars_anadromy.csv │ ├── PatchVars_bat.csv │ ├── PatchVars_climate.csv │ └── PatchVars_climate_original.csv └── popvars │ ├── PopVars.csv │ ├── PopVarsS1.csv │ ├── PopVarsS2.csv │ ├── PopVarsS3.csv │ ├── PopVars_AddFyy.csv │ ├── PopVars_AddMyy.csv │ ├── PopVars_Climate.csv │ ├── PopVars_IntroducePopulation.csv │ ├── PopVars_MultiClassvars.csv │ ├── PopVars_bat.csv │ └── PopVars_testMloci.csv └── src ├── CDmetaPOP.py ├── CDmetaPOP_Emigration.py ├── CDmetaPOP_Emigration.pyc ├── CDmetaPOP_Immigration.py ├── CDmetaPOP_Immigration.pyc ├── CDmetaPOP_Mate.py ├── CDmetaPOP_Mate.pyc ├── CDmetaPOP_Modules.py ├── CDmetaPOP_Modules.pyc ├── CDmetaPOP_Mortality.py ├── CDmetaPOP_Mortality.pyc ├── CDmetaPOP_Offspring2.py ├── CDmetaPOP_PostProcess.py ├── CDmetaPOP_PostProcess.pyc ├── CDmetaPOP_PreProcess.py ├── CDmetaPOP_PreProcess.pyc ├── CDmetaPOP_mainloop.py ├── CDmetaPOP_mainloop.pyc ├── __pycache__ ├── CDmetaPOP_Emigration.cpython-312.pyc ├── CDmetaPOP_Emigration.cpython-37.pyc ├── CDmetaPOP_Emigration.cpython-38.pyc ├── CDmetaPOP_Immigration.cpython-312.pyc ├── CDmetaPOP_Immigration.cpython-37.pyc ├── CDmetaPOP_Immigration.cpython-38.pyc ├── CDmetaPOP_Mate.cpython-312.pyc ├── CDmetaPOP_Mate.cpython-37.pyc ├── CDmetaPOP_Mate.cpython-38.pyc ├── CDmetaPOP_Modules.cpython-312.pyc ├── CDmetaPOP_Modules.cpython-37.pyc ├── CDmetaPOP_Modules.cpython-38.pyc ├── CDmetaPOP_Mortality.cpython-312.pyc ├── CDmetaPOP_Mortality.cpython-37.pyc ├── CDmetaPOP_Mortality.cpython-38.pyc ├── CDmetaPOP_Offspring.cpython-37.pyc ├── CDmetaPOP_Offspring.cpython-38.pyc ├── CDmetaPOP_Offspring2.cpython-312.pyc ├── CDmetaPOP_Offspring2.cpython-38.pyc ├── CDmetaPOP_PostProcess.cpython-312.pyc ├── CDmetaPOP_PostProcess.cpython-37.pyc ├── CDmetaPOP_PostProcess.cpython-38.pyc ├── CDmetaPOP_PreProcess.cpython-312.pyc ├── CDmetaPOP_PreProcess.cpython-37.pyc ├── CDmetaPOP_PreProcess.cpython-38.pyc ├── CDmetaPOP_mainloop.cpython-312.pyc ├── CDmetaPOP_mainloop.cpython-37.pyc └── CDmetaPOP_mainloop.cpython-38.pyc └── post_analysis_scripts ├── GeneticDistancev0.99.14.py ├── countAlleles_v1.py ├── diagnostics_batch_v1.00.py ├── diagnostics_batch_v1.08.py ├── diagnostics_batch_v2.py ├── diagnostics_batch_v3.py ├── diagnostics_batch_v4.py ├── diagnostics_class_v098.py ├── diagnostics_onebatch_v099.py ├── genetics_v1.00.py ├── geneticvulnerabilityv1.00.py ├── geneticvulnerabilityv1.08.py ├── geneticvulnerabilityv2.py ├── geneticvulnerabilityv3.py ├── genevalidate_v1.py ├── growthfit.R ├── indFormattoGENALEXv1.00.py ├── indFormattoGENALEXv1.41.py ├── indFormattoGENEPOPv1.00.py ├── indFormattoGENEPOPv1.41.py ├── indFormattoGENEPOPv2.39.py ├── indFormattoGENEPOPv2.40.py ├── morteggs.py ├── plotCDist_v0.py ├── plotRSI_batch_v1.00.py ├── plotSizeAgeGenes_v0.py ├── plotSizeAge_v0.py ├── populationDeaths_onebatch_v1.08.py ├── population_byStreamSegmentCode_v0.py ├── population_byStreamSegmentCode_v1.py ├── population_byStreamSegmentCode_v2.py ├── population_onebatch_v1.08.py ├── population_onebatch_v1.40.py ├── population_onebatch_v2.py ├── sGD_Python_v1.02_forpatches_buc.py ├── sGD_Python_v1.02_forpatches_unicorn.py └── splitpatch_v100.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /CDMetaPOP_v2.73.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/CDMetaPOP_v2.73.zip -------------------------------------------------------------------------------- /CDMetaPOP_v2.74.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/CDMetaPOP_v2.74.zip -------------------------------------------------------------------------------- /CDMetaPOP_v2.75.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/CDMetaPOP_v2.75.zip -------------------------------------------------------------------------------- /CDMetaPOP_v2.76.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/CDMetaPOP_v2.76.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ====== 2 | README 3 | ====== 4 | 5 | ---------------------- 6 | CDMetaPOP 2.00 release 7 | ---------------------- 8 | 9 | Welcome to the CDMetaPOP v2.0 release! This release includes installation instructions, version notes, some examples, and technical documentation. 10 | 11 | Program Contributors: Erin Landguth, Andrew Bearlin, Casey Day, Jason Dunham, Ryan Simmons, Brenna Forrester, Kaeli Davenport, and Travis Seaborn 12 | Link: https://github.com/ComputationalEcologyLab/CDMetaPOP 13 | Version: 2.00 14 | Python: 3.8 15 | Release Date: 2022.7.18 16 | README Update: 2022.7.18 (cdd) 17 | 18 | -------- 19 | Contents 20 | -------- 21 | 22 | Included in this release are the following: 23 | 24 | src -> CDMetaPOP source files 25 | doc -> README.txt, user manual, history, and disclaimer 26 | example_files -> test example files 27 | 28 | --------------------------------------- 29 | Requirements and Pre-requisite Software 30 | --------------------------------------- 31 | 32 | 1. Baseline Requirements. CDMetaPOP requires the Python3.8.x interpreter, NumPy package, and SciPy package. Remember that Python modules usually require particular Python interpreters, so be sure the version ID for any external Python module or package (e.g. NumPy or others) matches the version of your Python interpreter (normally v3.8.x). To avoid Python installation errors, we highly recommend installing Python from any number of the freely available bundlers, e.g., Anaconda (recommended), Canopy, ActiveState. 33 | 34 | --------------------------- 35 | CDMetaPOP v2.0 Installation 36 | --------------------------- 37 | 38 | Linux or Windows: Unpack the CDMetaPOP Archive. Navigate to the directory on your PC where you wish to install CDMetaPOP, and unpack the supplied zip archive file using a free archive tool like 7Zip (7z.exe), Pkunzip, Unzip, or an equivalent. Seven-Zip (7Z.exe) is highly recommended since it can handle all common formats on Windows, MAC OS X and Linux. On Windows, it is best to setup a project specific modeling subdirectory to perform your modeling outside of any folder that has spaces in its name (like "My Documents"). 39 | 40 | --------------------- 41 | Example CDMetaPOP Run 42 | --------------------- 43 | 44 | The example run is for 7 patches representing an effective distance matrix calculated using a least-cost path algorithm through riverine distance . To run the following example, follow these steps: 45 | 46 | 1. Double check that the 3 directories provided in the archive are in the same directory. 47 | 48 | 2. The included file ‘RunVars.csv’ in the data directory specifies the parameters that apply to all species that can be changed and used in a sample CDMetaPOP run. Open ‘RunVars.csv’ in your editor of choice. A spreadsheet program like Microsoft Excel, allows for easy editing of the tabular values. The 'PopVars' file location(s) (one for each species in the simulation) are specified in the first column. 49 | 50 | 3. The various ‘PopVars’ files define the patch files in the first column. The included files ‘PatchVars’ files will also be in the same folder (../data/patchvars). ‘ClassVars’ files are in turn specified in the ‘PatchVars’ files and example ‘ClassVars’ files will be in the ../data/classvars/ folder. 51 | 52 | 4. There will be 3 lines of information in ‘RunVars.csv’: a header line and 5 lines of information corresponding to 5 separate, single-species CDMetaPOP runs (batches). See Table 1 in user manual which contains a breakdown for each column header and the parameters that can be changed. The ‘Input’ in the table listed is for the first row in the file. Make sure you save this file in the same format – a comma delimited file – when you make changes to the parameters. Do not change the ‘Input’ (first row) labeling. Select ‘Yes’ or ‘OK’ for any Excel questions about saving in this format. 'RunVars_multispecies.csv' provides example inputs for 2 species, and 'RunVars_3species.csv' provides example inputs for 3 species. 53 | 54 | 5. Start the program: For example, if you use python from the command line, then open a terminal window and change your shell directory to the CDMetaPOP src home directory (i.e., > cd C:\"homedirectorylocation"\src). 55 | 56 | 6. Run the program: There are a number of ways to run this program. If you are using a command shell you can run the program by typing “python CDMetaPOP.py C:/”homedirectorylocation”/data RunVars.csv output_test”. Or a short-cut if your data is located at the same folder level as the src folder: “python CDMetaPOP.py ../data/ PopVars.csv output_test”. Note that there are 5 arguments here that must be included with spaces in between: 57 | 58 | a. “python” starts python, for example from the command line. Note that other python environments may have different calls here. In iPython (the IDE distributed with Anaconda) the call is “run”. 59 | b. “CDMetaPOP.py” runs CDMetaPOP program. 60 | c. “C:/”homedirectorylocation”/data” is the directory location of the input test files. You can point this directory to other project files, for example. We suggest not having any spaces in your directory names. So as projects accumulate you can rename input folders that contain the project specific files (e.g., dataWestslope or dataBullTrout). 61 | d. “RunVars.csv” is the parameter file (comma delimited) which can be renamed (e.g., “RunVars_WCT.csv”). Caution should be taken when going between operating systems and saving this file as a .csv. 62 | e. “output_test” is the name of the directory that will be created with CDMetaPOP output in the directory specified by the third argument above. 63 | 64 | 7. Check for successful model run completion: The program will provide step-by-step output in the Shell window. Each row of RunVars.csv will be repeated for each line in PopVars.csv. Once completed, a simulation time will be printed out and folders run0batch0mc0, run0batch0mc1, run0batch1mc0, etc. will be created in your CDMetaPOP home directory to store output from the separate batch and/or Monte-Carlo runs (each line in the RunVars file corresponds to a separate 'run' and each line in the PopVars file corresponds to a separate 'batch'. Monte Carlo runs are specified by 'mc'). These folders are located in the data folder specified in above step. The output folder will have a unique date/time stamp after the name of the output folder in case you want to run multiple CDMetaPOP runs in this same directory. The program will also provide a log file with program steps in your specified output directory. If parameters are such that all species become extinct before the specified generation time, the program will end. The program will provide error and feedback for parameters that are outside of ranges or incorrectly entered. 65 | 66 | Happy Simulations! 67 | 68 | Erin. 69 | 70 | Contact Information 71 | Erin Landguth 72 | Computational Ecology Laboratory 73 | The University of Montana 74 | 32 Campus Drive 75 | Missoula MT, 59812-1002 76 | erin.landguth@mso.umt.edu 77 | -------------------------------------------------------------------------------- /doc/.$FlowDiagrams.drawio.bkp: -------------------------------------------------------------------------------- 1 | 7Vtbb5swFP41UZ5aASaUPq5Numlqp66VtvVpcsENrCRmxiSkv34GbO60rAkXpeQlOZ9tID637xxgAi5XwWcCXesGm8iZKJIZTMB8ooQfwL5CZBcjujaLgSWxzRiSU+DefkEclDjq2ybychMpxg613Txo4PUaGTSHQULwNj/tCTv5s7pwiUrAvQGdMvrTNqkVo+eSlOJfkL20xJk1MbKCYjIHPAuaeJuBwGICLgnGNP61Ci6RE26e2Jd43VXNaHJhBK1pkwVsfL5bqT++321f6LNxq36VpROZq8ejO/GPkck2gIuYUAsv8Ro6ixS9MHyyQeFRZSYQ7K/NSJKYlC64xtjlU/4gSndctdCnmEEWXTl8FAU2/RUuP51x6SEzMg/4kSNhlxFuEbFXiCIisDUlu8yBQvEhO5YeKpLEsZ7wmvKLk3UmxxsS7kLtRnPIwz4x0Gu7yw0WkiWir8zTE3NgfoQw+1dkx9YR5EBqb/LXAblBL5N5qc7ZD672/zGB+Lgb6Pj8TBNFcyjfmZxtaH99LAZOvGjPPrEJsuoG0caJcfZryb+jAz0K4JtA2JU+FmcxLD6jgAuG6VGCnxMvVPJWxLzLDeetgmUYiE6fHLw1LEjoqYkM27Pxmk3aWjZF9y6MlLZl85LTbBChKHhd4WUF8QU693Ae4uQZl7dpwFA5ZGVihcAOrlFtMD4tZzw69e8an36n/0ZSMRi06NSgoVOrfTr12WBMQPrAJlATNroxAVAb10uRt3Gg12sC/Y3Nom64i1fJOYgYmy6mZbA25lelh4Ilp6Yp18T0jBnCRw87PkWfiCGMIURTSQ2TRymzZI1HPUyWUKV8mlDLWUJWKtKE3laakNXhBInj435q0xih9Bkk1A7J38NRkj9NLbA/rWf2J8+G49ZHmPv1pn4tVZtNR0XdWAMMwgh6ZYB6hwzwGhvQKfO8ue25iHiokhl+SBKYSxYK6J0E6oMJFEdIAkUX++1AcdZrtpA6pIHH2QM8SXgfd23QdxcQjOVdm57dtLcPQK+e3WV3/zgLPKAMzLHjjkFXnT3MTLTE3C6g8TxSunhUK/T1+m/sKWMHoNXQvy9X40tvsR05p2AQSoFBzGYFA4lzDV9WsJHkOvYwm7Fn0L7ZNGAMSq93DsVldpJd7pGDDBqm73LnAEFqeWOSEcGhePeo/87BeYfU8jiLxlmBWsoV1KFTaql02Qg4znLhTBuaTscHvA7tp6Dve3xKfQk4+un7/LR3nQJlMPS7r37dgSn52725fe/RNq3kzgtGExcL7VVy9c9+jSH/nf38Wd/xQRmf1dlbqWpNh6W3mF/Pt5Ndv0MGJma5Cp7eTauVdBhteCx60t9KjTKSl1nqI/R+mgKFelerqHf1ClW1Vu6CLp+nHfsiDe2k+O5Fm20RJqZva8WpOn3nDSz+AQ== -------------------------------------------------------------------------------- /doc/CDmetaPOPhistory.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/doc/CDmetaPOPhistory.txt -------------------------------------------------------------------------------- /doc/FlowDiagrams.Immigration_v0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/doc/FlowDiagrams.Immigration_v0.png -------------------------------------------------------------------------------- /doc/FlowDiagrams.Immigration_v1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/doc/FlowDiagrams.Immigration_v1.png -------------------------------------------------------------------------------- /doc/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/doc/README.txt -------------------------------------------------------------------------------- /doc/cdmetapop2_usermanual.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/doc/cdmetapop2_usermanual.docx -------------------------------------------------------------------------------- /doc/disclaimer_cdmetapop.txt: -------------------------------------------------------------------------------- 1 | disclaimer_cdmetapop.txt -- CDMetaPOP Software License 2 | 3 | rev 2011-07-13 4 | 5 | CDMetaPOP Software License Terms 6 | 7 | The software is in the public domain, and the recipient may not assert any proprietary rights thereto nor represent it to anyone as other than a University of Montana-produced program (version 1.x). CDMetaPOP is provided "as is" without warranty of any kind, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The user assumes all responsibility for the accuracy and suitability of this program for a specific application. In no event will the authors or the University be liable for any damages, including lost profits, lost savings, or other incidental or consequential damages arising from the use of or the inability to use this program. Although this program has been used by the USGS, no warranty, expressed or implied, is made by the USGS or the United States Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith. 8 | 9 | We strongly urge you to read the entire documentation before ever running CDMetaPOP. We wish to remind users that we are not in the commercial software marketing business. We are scientists who recognized the need for a tool like CDMetaPOP to assist us in our research on landscape genetic issues. Therefore, we do not wish to spend a great deal of time consulting on trivial matters concerning the use of CDMetaPOP. However, we do recognize an obligation to provide some level of information support. Of course, we welcome and encourage your criticisms and suggestions about the program at all times. We will welcome questions about how to run CDMetaPOP or interpret the output only after you have read the entire documentation. This is only fair and will eliminate many trivial questions. Finally, we are always interested in learning about how others have applied CDMetaPOP in ecological investigation and management application. Therefore, we encourage you to contact us and describe your application after using CDMetaPOP. -------------------------------------------------------------------------------- /example_files/RunVars.csv: -------------------------------------------------------------------------------- 1 | Popvars,sizecontrol,constMortans,mcruns,runtime,output_years,gridformat,gridsampling,summaryOutput,cdclimgentime,startcomp,implementcomp 2 | popvars/PopVars.csv,N,1,1,5,1,cdpop,Sample,N,0|1|2,0,Back 3 | popvars/PopVars.csv,N,1,1,5,1,cdpop,Sample,N,0|1|2,0,Back 4 | popvars/PopVars_IntroducePopulation.csv,N,1,1,5,1,cdpop,Sample,N,0|5,0,Back 5 | popvars/PopVars_Climate.csv,N,1,1,5,1,cdpop,Sample,N,0|4|8,0,Back 6 | -------------------------------------------------------------------------------- /example_files/RunVars_AddFyy.csv: -------------------------------------------------------------------------------- 1 | Popvars,sizecontrol,constMortans,mcruns,runtime,output_years,gridformat,gridsampling,summaryOutput,cdclimgentime,startcomp,implementcomp 2 | popvars/PopVars_AddFyy.csv,N,2,1,10,1,genepop,Sample,N,0|1,0,Back 3 | -------------------------------------------------------------------------------- /example_files/RunVars_AddMyy.csv: -------------------------------------------------------------------------------- 1 | Popvars,sizecontrol,constMortans,mcruns,runtime,output_years,gridformat,gridsampling,summaryOutput,cdclimgentime,startcomp,implementcomp 2 | popvars/PopVars_AddMyy.csv,N,2,1,10,1,genepop,Sample,N,0|1,0,Back 3 | -------------------------------------------------------------------------------- /example_files/RunVars_multispecies.csv: -------------------------------------------------------------------------------- 1 | Popvars,sizecontrol,constMortans,mcruns,runtime,output_years,gridformat,gridsampling,summaryOutput,cdclimgentime,startcomp,implementcomp 2 | popvars/PopVarsS1.csv;popvars/PopVarsS2.csv,N,2,1,10,1,cdpop,Sample,N,0|1,0,Back 3 | popvars/PopVarsS1.csv;popvars/PopVarsS2.csv;popvars/PopVarsS3.csv,N,2,1,10,1,cdpop,Sample,N,0|1,0,Back 4 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_CdmatrixS1.csv: -------------------------------------------------------------------------------- 1 | 0.0,5858.03173955,10782.6825279,17700.285707,13262.5396744,17344.9364954,20402.8253814 2 | 5858.03173955,0.0,5053.52380466,23558.3174466,19120.571414,23202.9682349,14673.6666582 3 | 10782.6825279,5053.52380466,0.0,28482.9682349,24045.2222024,28127.6190233,9620.1428535 4 | 17700.285707,23558.3174466,28482.9682349,0.0,17260.285707,25227.1904628,38103.1110884 5 | 13262.5396744,19120.571414,24045.2222024,17260.285707,0.0,20918.3174466,33665.3650559 6 | 17344.9364954,23202.9682349,28127.6190233,25227.1904628,20918.3174466,0.0,37747.7618768 7 | 20402.8253814,14673.6666582,9620.1428535,38103.1110884,33665.3650559,37747.7618768,0.0 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_CdmatrixS1_Barriers.csv: -------------------------------------------------------------------------------- 1 | 0,5858.03174,10782.68253,17700.28571,13262.53967,17344.9365,100000 2 | 5858.03174,0,5053.523805,23558.31745,19120.57141,23202.96823,100000 3 | 10782.68253,5053.523805,0,28482.96823,24045.2222,28127.61902,100000 4 | 17700.28571,23558.31745,28482.96823,0,17260.28571,25227.19046,100000 5 | 13262.53967,19120.57141,24045.2222,17260.28571,0,20918.31745,100000 6 | 17344.9365,23202.96823,28127.61902,25227.19046,20918.31745,0,100000 7 | 20402.82538,14673.66666,9620.142854,38103.11109,33665.36506,37747.76188,0 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_CdmatrixS2.csv: -------------------------------------------------------------------------------- 1 | 0.0,5858.03173955,10782.6825279,17700.285707,13262.5396744,17344.9364954,20402.8253814 2 | 5858.03173955,0.0,5053.52380466,23558.3174466,19120.571414,23202.9682349,14673.6666582 3 | 10782.6825279,5053.52380466,0.0,28482.9682349,24045.2222024,28127.6190233,9620.1428535 4 | 17700.285707,23558.3174466,28482.9682349,0.0,17260.285707,25227.1904628,38103.1110884 5 | 13262.5396744,19120.571414,24045.2222024,17260.285707,0.0,20918.3174466,33665.3650559 6 | 17344.9364954,23202.9682349,28127.6190233,25227.1904628,20918.3174466,0.0,37747.7618768 7 | 20402.8253814,14673.6666582,9620.1428535,38103.1110884,33665.3650559,37747.7618768,0.0 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_Probmatrix.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1,1,1 2 | 1,1,1,1,1,1,1 3 | 1,1,1,1,1,1,1 4 | 0,0,0,1,1,1,0 5 | 0,0,0,1,1,1,0 6 | 0,0,0,1,1,1,0 7 | 0.6,0.6,0.6,0.6,0.6,0.6,1 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_Probmatrix_Dispersal.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1,1,0 2 | 1,1,1,1,1,1,0 3 | 1,1,1,1,1,1,0 4 | 1,1,1,1,1,1,0 5 | 1,1,1,1,1,1,0 6 | 1,1,1,1,1,1,0 7 | 0,0,0,0,0,0,0 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_Probmatrix_onewayBarriers.csv: -------------------------------------------------------------------------------- 1 | 1,1,1,1,1,1,1 2 | 1,1,1,1,1,1,1 3 | 1,1,1,1,1,1,1 4 | 0,0,0,1,1,1,0 5 | 0,0,0,1,1,1,0 6 | 0,0,0,1,1,1,0 7 | 0.6,0.6,0.6,0.6,0.6,0.6,1 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv: -------------------------------------------------------------------------------- 1 | 1,0.84625844,0.717013067,0.535463504,0.651930268,0.544789494,0.464536496 2 | 0.84625844,1,0.86737241,0.381721944,0.498188708,0.391047934,0.614895838 3 | 0.717013067,0.86737241,1,0.252476572,0.368943335,0.261802561,0.747523428 4 | 0,0,0,1,0.547011118,0.337923079,0 5 | 0,0,0,0.547011118,1,0.451007625,0 6 | 0,0,0,0.337923079,0.451007625,1,0 7 | 0.278721898,0.368937503,0.448514057,0.2,0.069880058,0.005595594,1 8 | -------------------------------------------------------------------------------- /example_files/cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS2.csv: -------------------------------------------------------------------------------- 1 | 1,0.84625844,0.717013067,0.535463504,0.651930268,0.544789494,0.464536496 2 | 0.84625844,1,0.86737241,0.381721944,0.498188708,0.391047934,0.614895838 3 | 0.717013067,0.86737241,1,0.252476572,0.368943335,0.261802561,0.747523428 4 | 0,0,0,1,0.547011118,0.337923079,0 5 | 0,0,0,0.547011118,1,0.451007625,0 6 | 0,0,0,0.337923079,0.451007625,1,0 7 | 0.278721898,0.368937503,0.448514057,0,0.069880058,0.005595594,1 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_AS1.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,31,0,0.5,.50~.50,0,0,0,0,0,0,0,0,0,1,0.2,0.2,0,0,0,0,0,N,N 3 | 1,53,5,0.25,.50~.50,0,0,0,0,0,0,0,0,0.1,1,0.2,0.2,1,5,0,2.5,0,N,N 4 | 2,92,0,0.125,.50~.50,0,0,0,0,0,0,0,0,0.3,1,0.2,0.2,1,5,0,10,0,N,N 5 | 3,123,10,0.0625,.50~.50,0,0,0,0,0,0,0,0,0.5,1,0.2,0.2,1,10,0,11.7,0,N,N 6 | 4,147,10,0.03,.50~.50,0,0,0,0,0,0,0,0,1,1,0.2,0.2,1,10,0,11.743,0,N,N 7 | 5,184,10,0.015,.50~.50,0,0,1,0,0,0,0,0,1,1,0.2,0.2,1,10,0,15,0,N,N 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_AS2.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,51,0,1,.5~.5,0,0,0.5,0,0,0,0,0,1,1,1,0,0,0,0,0,0,N,N 3 | 1,73,5,1,.5~.5,0,0,0.5,0,0,0,0,0,1,1,1,1,1,5,0,2.5,0,N,N 4 | 2,102,0,1,.5~.5,0,0,0.5,0,0,0,0,0,1,1,1,1,1,5,0,10,0,N,N 5 | 3,143,10,1,.5~.5,0,0,0.5,0,0,0,0,0,1,1,1,1,1,10,0,11.7,0,N,N 6 | 4,157,10,1,.5~.5,0,0,0.5,0,0,0,0,0,1,1,1,1,1,10,0,11.743,0,N,N 7 | 5,194,10,1,.5~.5,0,0,1,0,0,0,0,0,1,1,1,1,1,10,0,15,0,N,N 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_AddFYY.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,31,0,1,0~0~0~1,0.5,0,0,0,0,0,0.1,0,0~0~0~0,1,0~0~0~0,0~0~0~0,0,0,0,0,0,N ,0.5~0.5~1~1 3 | 1,53,5,1,0~0~0~1,0.5,0,0,0,0.5,0,.5~0~.5~.10,0,0.5~0.5~1~1,1,0.5~0.5~1~1,0.5~0.5~1~1,0,0,0,0,0,N ,0.5~0.5~1~1 4 | 2,92,0,1,0~0~0~1,0.5,0,1,0,0.5,0,0.02,0,0.5~0.5~1~1,1,0.5~0.5~1~1,0.5~0.5~1~1,0.11~0.1~0.11~0.1,0,0,0,0,N ,0.5~0.5~1~1 5 | 3,123,10,1,0~0~0~1,0.5,0,0.5,0,0.5,0,0.2,0,0.5~0.5~1~1,1,0.5~0.5~1~1,0.5~0.5~1~1,0.18,0,20,100,10,N ,0.5~0.5~1~1 6 | 4,147,10,1,0~0~0~1,0.5,0,1,0,0.5,0,0,0,0.5~0.5~1~1,1,0.5~0.5~1~1,0.5~0.5~1~1,0.82,120,20,200,20,N ,0.5~0.5~1~1 7 | 5,184,10,1,0~0~0~1,0.5,0,1,0,0.5,0,0.2,0,0.5~0.5~1~1,1,0.5~0.5~1~1,0.5~0.5~1~1,0.99,350,20,300,30,N ,0.5~0.5~1~1 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_AddYY.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,31,0,1,0~0~1,.2~.2~.2,0,0,0,N,0,0.1,0,0,0,0,0,0,0,0,0,0,N~N~0,0.1~0.1~0.1 3 | 1,53,5,1,0~0~1,0.5,0,0,0,N,0,0.5,0,1,1,0.5,1,0,0,0,0,0,N~N~0.5,0.2~0.2~0.2 4 | 2,92,0,1,0~0~1,0.5,0,1,0,N,0,2,0,1,1,0.5,1,0.11,0,0,0,0,N~N~0.5,0.3~0.3~0.3 5 | 3,123,10,1,0~0~1,0.5,0,0.5,0,0.5,0,2,0,1,1,0.5,1,0.18,0,20,0,20,N~N~0.5,0.4~0.4~0.4 6 | 4,147,10,1,0~0~1,0.5,0,1,0,0.5,0,0,0,1,1,0.5,1,0.82,120,20,120,20,N~N~0.5,0.5~0.5~0.5 7 | 5,184,10,1,0~0~1,0.5,0,1,0,0.5,0,2,0,1,1,0.5,1,0.99,350,20,350,20,N~N~0.5,0.6~0.6~0.6 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_StartFYY.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,31,0,1,0.5~0.5~0~0,0.2~0.2~0.2~0.2,0,0.2~0.2~0.2~0.2,0,0.2~0.2~0.2~0.2,0,0.2~0.2~0.2~0.2,0,1,1,1,0,0,0,0,0,0,N,N 3 | 1,53,5,1,0.5~0.5~0~0,0,0,0.5,0,0,0,0,0,1,1,1,1,1,5,0,2.5,0,N,N 4 | 2,92,0,1,0.5~0.5~0~0,0,0,0.6,0,0,0,0,0,1,1,1,1,1,5,0,10,0,N,N 5 | 3,123,10,1,0.5~0.5~0~0,0,0,0.7,0,0,0,0,0,1,1,1,1,1,10,0,11.7,0,N,N 6 | 4,147,10,1,0.5~0.5~0~0,0,0,0.8,0,0,0,0,0,1,1,1,1,1,10,0,11.743,0,N,N 7 | 5,184,10,1,0.5~0.5~0~0,0,0,1,0,0,0,0,0,1,1,1,1,1,10,0,15,0,N,N 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_StartYY.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,31,0,1,0.5~0.5~0,0.2~0.2~0.2,0,0.2~0.2~0.2,0,0,0,0,0,1,1,1,0,0,0,0,0,0,N,N 3 | 1,53,5,1,0.5~0.5~0,0,0,0,0,0,0,0,0,1,1,1,1,1,5,0,2.5,0,N,N 4 | 2,92,0,1,0.5~0.5~0,0,0,0,0,0,0,0,0,1,1,1,1,1,5,0,10,0,N,N 5 | 3,123,10,1,0.5~0.5~0,0,0,0,0,0,0,0,0,1,1,1,1,1,10,0,11.7,0,N,N 6 | 4,147,10,1,0.5~0.5~0,0,0,0,0,0,0,0,0,1,1,1,1,1,10,0,11.743,0,N,N 7 | 5,184,10,1,0.5~0.5~0,0,0,0.5,0,0,0,0,0,1,1,1,1,1,10,0,15,0,N,N 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_anadromy.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out %,Age Mortality Out StDev,Age Mortality Back %,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,Migration Out Prob,Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,31,0,0.5,.50~.50,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,N,N 3 | 1,53,5,0.25,.50~.50,0,0,0,0,0,0,0,0,1,0,0,0,0,5,0,2.5,0,N,N 4 | 2,92,0,0.125,.50~.50,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,10,0,N,N 5 | 3,123,10,0.0625,.50~.50,0,0,0,0,0,0,0,0,0,1,0,0,1,10,0,11.7,0,N,N 6 | 4,147,10,0.03,.50~.50,0,0,0,0,0,0,0,0,0,1,0,0,1,10,0,11.743,0,N,N 7 | 5,184,10,0.015,.50~.50,0,0,1,0,0,0,0,0,0,1,0,0,1,10,0,15,0,N,N 8 | -------------------------------------------------------------------------------- /example_files/classvars/ClassVars_bat.csv: -------------------------------------------------------------------------------- 1 | Age class,Body Size Mean (mm),Body Size Std (mm),Distribution,Sex Ratio,Age Mortality Out % - Summer,Age Mortality Out StDev,Age Mortality Back % - Winter,Age Mortality Back StDev,Size Mortality Out %,Size Mortality Out StDev,Size Mortality Back %,Size Mortaltiy Back StDev,FROM Breed TO Birth - Migration Out Prob,FROM Birth TO Breed - Migration Back Prob,Straying Prob,Dispersal Prob,Maturation,Fecundity Ind,Fecundity Ind StDev,Fecundity Leslie,Fecundity Leslie StDev,Capture Out Probability,Capture Back Probability 2 | 0,0,0,0.5,.50~.50,0,0,0.5,0,0,0,0,0,1,1,0,0,0,0,0,0,0,N,N 3 | 1,0,0,0.25,.50~.50,0,0,0.25,0,0,0,0,0,1,1,0,0,1,2,0,2,0,N,N 4 | 2,0,0,0.125,.50~.50,0,0,0.2,0,0,0,0,0,1,1,0,0,1,2,0,2,0,N,N 5 | 3,0,0,0.0625,.50~.50,0,0,0.18,0,0,0,0,0,1,1,0,0,1,2,0,2,0,N,N 6 | 4,0,0,0.03,.50~.50,0,0,0.16,0,0,0,0,0,1,1,0,0,1,2,0,2,0,N,N 7 | 5,0,0,0.015,.50~.50,0,0,0.14,0,0,0,0,0,1,1,0,0,1,2,0,2,0,N,N 8 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyA.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.25 3 | L0A1,0.75 4 | L1A2,0.5 5 | L1A3,0.5 6 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyAS1.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L0A2,0 5 | L0A3,0 6 | L0A4,0 7 | L1A0,0.0005 8 | L1A1,0.9995 9 | L1A2,0 10 | L1A3,0 11 | L1A4,0 12 | L2A0,0.0005 13 | L2A1,0.9995 14 | L2A2,0 15 | L2A3,0 16 | L2A4,0 17 | L3A0,0.0005 18 | L3A1,0.9995 19 | L3A2,0 20 | L3A3,0 21 | L3A4,0 22 | L4A0,0.0005 23 | L4A1,0.9995 24 | L4A2,0 25 | L4A3,0 26 | L4A4,0 27 | L5A0,0.0005 28 | L5A1,0.9995 29 | L5A2,0 30 | L5A3,0 31 | L5A4,0 32 | L6A0,0.0005 33 | L6A1,0.9995 34 | L6A2,0 35 | L6A3,0 36 | L6A4,0 37 | L7A0,0.0005 38 | L7A1,0.9995 39 | L7A2,0 40 | L7A3,0 41 | L7A4,0 42 | L8A0,0.0005 43 | L8A1,0.9995 44 | L8A2,0 45 | L8A3,0 46 | L8A4,0 47 | L9A0,0.0005 48 | L9A1,0.9995 49 | L9A2,0 50 | L9A3,0 51 | L9A4,0 52 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyAS2.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L0A2,0 5 | L0A3,0 6 | L0A4,0 7 | L1A0,0.0005 8 | L1A1,0.9995 9 | L1A2,0 10 | L1A3,0 11 | L1A4,0 12 | L2A0,0.0005 13 | L2A1,0.9995 14 | L2A2,0 15 | L2A3,0 16 | L2A4,0 17 | L3A0,0.0005 18 | L3A1,0.9995 19 | L3A2,0 20 | L3A3,0 21 | L3A4,0 22 | L4A0,0.0005 23 | L4A1,0.9995 24 | L4A2,0 25 | L4A3,0 26 | L4A4,0 27 | L5A0,0.0005 28 | L5A1,0.9995 29 | L5A2,0 30 | L5A3,0 31 | L5A4,0 32 | L6A0,0.0005 33 | L6A1,0.9995 34 | L6A2,0 35 | L6A3,0 36 | L6A4,0 37 | L7A0,0.0005 38 | L7A1,0.9995 39 | L7A2,0 40 | L7A3,0 41 | L7A4,0 42 | L8A0,0.0005 43 | L8A1,0.9995 44 | L8A2,0 45 | L8A3,0 46 | L8A4,0 47 | L9A0,0.0005 48 | L9A1,0.9995 49 | L9A2,0 50 | L9A3,0 51 | L9A4,0 52 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyB.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L0A2,0.0000 5 | L0A3,0.0000 6 | L0A4,0.0000 7 | L1A0,0.2000 8 | L1A1,0.2000 9 | L1A2,0.2000 10 | L1A3,0.2000 11 | L1A4,0.2000 12 | L2A0,0.2000 13 | L2A1,0.2000 14 | L2A2,0.2000 15 | L2A3,0.2000 16 | L2A4,0.2000 17 | L3A0,0.2000 18 | L3A1,0.2000 19 | L3A2,0.2000 20 | L3A3,0.2000 21 | L3A4,0.2000 22 | L4A0,0.2000 23 | L4A1,0.2000 24 | L4A2,0.2000 25 | L4A3,0.2000 26 | L4A4,0.2000 27 | L5A0,0.2000 28 | L5A1,0.2000 29 | L5A2,0.2000 30 | L5A3,0.2000 31 | L5A4,0.2000 32 | L6A0,0.2000 33 | L6A1,0.2000 34 | L6A2,0.2000 35 | L6A3,0.2000 36 | L6A4,0.2000 37 | L7A0,0.2000 38 | L7A1,0.2000 39 | L7A2,0.2000 40 | L7A3,0.2000 41 | L7A4,0.2000 42 | L8A0,0.2000 43 | L8A1,0.2000 44 | L8A2,0.2000 45 | L8A3,0.2000 46 | L8A4,0.2000 47 | L9A0,0.2000 48 | L9A1,0.2000 49 | L9A2,0.2000 50 | L9A3,0.2000 51 | L9A4,0.2000 52 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyBT.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,1 3 | L0A1,0 4 | L0A2,0 5 | L0A3,0 6 | L0A4,0 7 | L1A0,0.0005 8 | L1A1,0.9995 9 | L1A2,0 10 | L1A3,0 11 | L1A4,0 12 | L2A0,0.0005 13 | L2A1,0.9995 14 | L2A2,0 15 | L2A3,0 16 | L2A4,0 17 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyC.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L0A2,0.0000 5 | L0A3,0.0000 6 | L0A4,0.0000 7 | L1A0,0.2000 8 | L1A1,0.2000 9 | L1A2,0.2000 10 | L1A3,0.2000 11 | L1A4,0.2000 12 | L2A0,0.2000 13 | L2A1,0.2000 14 | L2A2,0.2000 15 | L2A3,0.2000 16 | L2A4,0.2000 17 | L3A0,0.2000 18 | L3A1,0.2000 19 | L3A2,0.2000 20 | L3A3,0.2000 21 | L3A4,0.2000 22 | L4A0,0.2000 23 | L4A1,0.2000 24 | L4A2,0.2000 25 | L4A3,0.2000 26 | L4A4,0.2000 27 | L5A0,0.2000 28 | L5A1,0.2000 29 | L5A2,0.2000 30 | L5A3,0.2000 31 | L5A4,0.2000 32 | L6A0,0.2000 33 | L6A1,0.2000 34 | L6A2,0.2000 35 | L6A3,0.2000 36 | L6A4,0.2000 37 | L7A0,0.2000 38 | L7A1,0.2000 39 | L7A2,0.2000 40 | L7A3,0.2000 41 | L7A4,0.2000 42 | L8A0,0.2000 43 | L8A1,0.2000 44 | L8A2,0.2000 45 | L8A3,0.2000 46 | L8A4,0.2000 47 | L9A0,0.2000 48 | L9A1,0.2000 49 | L9A2,0.2000 50 | L9A3,0.2000 51 | L9A4,0.2000 52 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyD.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L0A2,0.0000 5 | L0A3,0.0000 6 | L0A4,0.0000 7 | L1A0,0.2000 8 | L1A1,0.2000 9 | L1A2,0.2000 10 | L1A3,0.2000 11 | L1A4,0.2000 12 | L2A0,0.2000 13 | L2A1,0.2000 14 | L2A2,0.2000 15 | L2A3,0.2000 16 | L2A4,0.2000 17 | L3A0,0.2000 18 | L3A1,0.2000 19 | L3A2,0.2000 20 | L3A3,0.2000 21 | L3A4,0.2000 22 | L4A0,0.2000 23 | L4A1,0.2000 24 | L4A2,0.2000 25 | L4A3,0.2000 26 | L4A4,0.2000 27 | L5A0,0.2000 28 | L5A1,0.2000 29 | L5A2,0.2000 30 | L5A3,0.2000 31 | L5A4,0.2000 32 | L6A0,0.2000 33 | L6A1,0.2000 34 | L6A2,0.2000 35 | L6A3,0.2000 36 | L6A4,0.2000 37 | L7A0,0.2000 38 | L7A1,0.2000 39 | L7A2,0.2000 40 | L7A3,0.2000 41 | L7A4,0.2000 42 | L8A0,0.2000 43 | L8A1,0.2000 44 | L8A2,0.2000 45 | L8A3,0.2000 46 | L8A4,0.2000 47 | L9A0,0.2000 48 | L9A1,0.2000 49 | L9A2,0.2000 50 | L9A3,0.2000 51 | L9A4,0.2000 52 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyDV.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0 3 | L0A1,1 4 | L0A2,0 5 | L0A3,0 6 | L0A4,0 7 | L1A0,0.0005 8 | L1A1,0.9995 9 | L1A2,0 10 | L1A3,0 11 | L1A4,0 12 | L2A0,0.0005 13 | L2A1,0.9995 14 | L2A2,0 15 | L2A3,0 16 | L2A4,0 17 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyInitVar.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L1A0,0.2 5 | L1A1,0.2 6 | L1A2,0.2 7 | L1A3,0.2 8 | L1A4,0.2 9 | -------------------------------------------------------------------------------- /example_files/genes/allelefrequencyTime1.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0.0005 3 | L0A1,0.9995 4 | L1A0,0.0005 5 | L1A1,0.9995 6 | L1A2,0 7 | L1A3,0 8 | L1A4,0 9 | -------------------------------------------------------------------------------- /example_files/genes/wildtype_hindex1.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,1 3 | L0A1,0 4 | -------------------------------------------------------------------------------- /example_files/genes/yytype_hindex0.csv: -------------------------------------------------------------------------------- 1 | Allele List,Frequency 2 | L0A0,0 3 | L0A1,1 4 | -------------------------------------------------------------------------------- /example_files/otherfiles/3popmort_PhaseI.csv: -------------------------------------------------------------------------------- 1 | ,Pop1_TO,Pop2_TO,Pop3_TO 2 | Pop1,0,100,25 3 | Pop2,0,0,75 4 | Pop3,100,0,0 5 | -------------------------------------------------------------------------------- /example_files/otherfiles/3popmort_PhaseII.csv: -------------------------------------------------------------------------------- 1 | ,Pop1_TO,Pop2_TO,Pop3_TO 2 | Pop1,0,100,25 3 | Pop2,0,0,75 4 | Pop3,100,0,0 5 | -------------------------------------------------------------------------------- /example_files/otherfiles/Patch_r.csv: -------------------------------------------------------------------------------- 1 | ,K,popmort_out,temperature_out,growdays_out,popmort_back,temperature_back,growdays_back,eggmort 2 | K,1,0.1,0.1,0.1,0.1,0.1,0.1,0.1 3 | popmort_out,0.1,1,0.2,0.2,0,0,0,0.2 4 | temperature_out,0.1,0.2,1,0.2,0,0,0,0.2 5 | growdays_out,0.1,0.2,0.2,1,0,0,0,0.2 6 | popmort_back,0.1,0,0,0,1,0.2,0.2,0.2 7 | temperature_back,0.1,0,0,0,0.2,1,0.2,0.2 8 | growdays_back,0.1,0,0,0,0.2,0.2,1,0.2 9 | eggmort,0.1,0.2,0.2,0.2,0.2,2,0.2,1 10 | -------------------------------------------------------------------------------- /example_files/otherfiles/betafiles/Appendix2_betaFile_General.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/example_files/otherfiles/betafiles/Appendix2_betaFile_General.xlsx -------------------------------------------------------------------------------- /example_files/otherfiles/betafiles/betaFile_3X3L2A.csv: -------------------------------------------------------------------------------- 1 | ,X0L0,X0L1,X0L2,X1L0,X1L1,X1L2,X2L0,X2L1,X2L2 2 | A0,1,0,10,10,-10,0.1,0.1,0.1,0.1 3 | A1,1,0,0,-10,10,0.1,0.1,0.1,0.1 4 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Out Grounds,Genes Initialize,Class Vars,Mortality Out,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration Out,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,150,1,0,genes/allelefrequencyA.csv,classvars/ClassVars_AS1.csv,0,0,0,0,N,0,1,N,1,1,1,1,0,155 | 155 | 155,0,14,0,210,0,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,150,1,0,random,classvars/ClassVars_AS1.csv,0,0,0,0,N,0,1,N,1,1,1,1,0.2,150,20,18,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,150,1,0,random,classvars/ClassVars_AS1.csv,0,0,0,0,N,0,1,N,1,1,1,1,0.1,150,20,22,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,150,1,0,random,classvars/ClassVars_AS1.csv,0,0,0,0,N,0,1,N,1,1,1,1,1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,150,1,0,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,N,1,1,1,1,0.4,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,150,1,0,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,N,1,1,1,1,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,1000,0,0,0,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0,N,1,0,0,1,0,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVarsS1.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,150,1,1,genes/allelefrequencyA.csv,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,0,155 | 155 | 155,0,14,0,210,0,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,0.2,150,20,18,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,0.1,150,20,22,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,0.4,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,1,0,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVarsS2.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,130,0,65,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 3 | 2,2536859.926,708059.4624,1,255,0,127,0,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 4 | 3,2532969.44,705413.5711,2,236,0,100,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.1,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 5 | 4,2539041.489,728416.6747,2,100,0,34,0,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,1,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 6 | 5,2535011.582,720257.8531,3,143,0,71,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.4,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 7 | 6,2545325.475,726552.0418,3,119,0,59,0,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 8 | 7,2527429.642,708511.8011,3,158,0,79,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25;0.5 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVarsS3.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,200,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 3 | 2,2536859.926,708059.4624,1,300,0,200,0,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 4 | 3,2532969.44,705413.5711,2,300,0,200,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.1,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 5 | 4,2539041.489,728416.6747,2,300,0,200,0,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,1,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 6 | 5,2535011.582,720257.8531,3,300,0,200,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.4,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 7 | 6,2545325.475,726552.0418,3,300,0,200,0,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 8 | 7,2527429.642,708511.8011,3,300,0,200,1,1,random,classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.2;0.2 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_AddFyy.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Out Grounds,Genes Initialize,Class Vars,Mortality Out,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,100|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_StartFyy.csv|classvars/ClassVars_AddFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,100|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_StartFyy.csv|classvars/ClassVars_AddFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,100,1,1,genes/allelefrequencyBT.csv,classvars/ClassVars_StartFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.1,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,100,1,1,genes/allelefrequencyBT.csv,classvars/ClassVars_StartFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,1,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,100,1,1,genes/allelefrequencyBT.csv,classvars/ClassVars_StartFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.4,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,100,1,1,genes/allelefrequencyBT.csv,classvars/ClassVars_StartFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,300,0,100,1,1,genes/allelefrequencyBT.csv,classvars/ClassVars_StartFyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_AddMyy.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,200|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,200|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,200|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.1,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,200,1,1,genes/allelefrequencyBT.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,1,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,200|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.4,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,200|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,300,0,200|100,1,1,genes/allelefrequencyBT.csv|genes/allelefrequencyDV.csv,classvars/ClassVars_Startyy.csv|classvars/ClassVars_Addyy.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0,150,20,8,0,150,20,N,N,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_IntroducePopulation.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.4,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,300,0,100|20,1,1,random|random,classvars/ClassVars_AS1.csv|classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_MultiClassVars.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.4,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,300,0,150;150,1,1,genes/allelefrequencyBT.csv;genes/allelefrequencyDV.csv,classvars/ClassVars_AS1.csv;classvars/ClassVars_AS2.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_MultiLocus.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.4,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,300,0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,N,0,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_X3.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef,X1,X2,X3 2 | 1,2540470.832,712452.2021,1,130,0,65,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,0,-1,1 3 | 2,2536859.926,708059.4624,1,255,0,127,0,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,-1,-1,1 4 | 3,2532969.44,705413.5711,2,236,0,100,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.1,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,-1,1,1 5 | 4,2539041.489,728416.6747,2,100,0,34,0,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,1,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,-1,1,-1 6 | 5,2535011.582,720257.8531,3,143,0,71,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.4,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,1,-0.5,1 7 | 6,2545325.475,726552.0418,3,119,0,59,0,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0.2,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,0,-0.5,1 8 | 7,2527429.642,708511.8011,3,158,0,79,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,1,Y,1,1,1,8,0,150,20,N,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1,-1,-0.5,-1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_anadromy.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Out Grounds,Genes Initialize,Class Vars,Mortality Out,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration Out,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,300,0,150,1,0,genes/allelefrequencyA.csv,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,1,N,1,1,1,1,0,155 | 155 | 155,0,14,0,210,0,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,300,0,150,1,0,random,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,1,N,1,1,1,1,0.2,150,20,18,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,300,0,150,1,0,random,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,1,N,1,1,1,1,0.1,150,20,22,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,300,0,150,1,0,random,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,1,N,1,1,1,1,1,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,300,0,150,1,0,random,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,1,N,1,1,1,1,0.4,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,300,0,150,1,0,random,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,1,N,1,1,1,1,0.2,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,1000,0,0,0,1,random,classvars/ClassVars_anadromy.csv,0,0,0,0,0,0,0,N,1,0,0,1,0,150,20,8,0,150,20,N,N,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_bat.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Mating - Breed - Natal Grounds,Non-mating - Birth - Migration Out Grounds,Genes Initialize,Class Vars,Mortality Out,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,FROM Breed TO Birth - Migration Out Prob,Set Migration Out,FROM Birth TO Breed - Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,200,0,100,1,0,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,1,N,0,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,200,0,100,1,0,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,1,N,0,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 4 | 3,2532969.44,705413.5711,1,200,0,100,1,0,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,1,N,0,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,200,0,0,0,1,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,0,N,1,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 6 | 5,2535011.582,720257.8531,2,200,0,0,0,1,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,0,N,1,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 7 | 6,2545325.475,726552.0418,2,200,0,0,0,1,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,0,N,1,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 8 | 7,2527429.642,708511.8011,2,200,0,0,0,1,random,classvars/ClassVars_bat.csv,0,0,0,0,0,0,0,N,1,0,0,0,0,0,0,0,0,0,0,N,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_climate.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration Out Prob,Set Migration Out,Migration Back Prob,Straying Prob,Dispersal Prob,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,130|120|110,0|0|0,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.1|0|.2,265|300|265,0|0|0,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,255|235|215,10|0|10,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.2|.3|.4,265|300|265,1|0|2,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,236|235|234,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,0|0|0,265|300|265,20|30|40,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,69|69|69,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,1|2|3|,265|300|265,0|0|0,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,143|140|137,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.1|0|.2,265|300|265,0|0|0,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,119|118|117,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.2|.3|.4,265|300|265,1|0|2,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,158|148|138,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0,0,0,0,0,0,0.5|0.5|0.5,Y,1,1.0|0.5|0.05,1,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,0|0|0,265|300|265,20|30|40,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/patchvars/PatchVars_climate_original.csv: -------------------------------------------------------------------------------- 1 | PatchID,X,Y,SubpatchNO,K,K StDev,N0,Natal Grounds,Migration Grounds,Genes Initialize,Class Vars,Mortality Out %,Mortality Out StDev,Mortality Back,Mortality Back StDev,Mortality Eggs,Mortality Eggs StDev,Migration,Set Migration,Straying,GrowthTemperatureOut,GrowthTemperatureOutStDev,GrowDaysOut,GrowDaysOutStDev,GrowthTemperatureBack,GrowthTemperatureBackStDev,GrowDaysBack,GrowDaysBackStDev,Capture Probability Out,Capture Probability Back,HabitatOut,HabitatBack,Fitness_AA,Fitness_Aa,Fitness_aa,Fitness_BB,Fitness_Bb,Fitness_bb,Fitness_AABB,Fitness_AaBB,Fitness_aaBB,Fitness_AABb,Fitness_AaBb,Fitness_aaBb,Fitness_AAbb,Fitness_Aabb,Fitness_aabb,comp_coef 2 | 1,2540470.832,712452.2021,1,130|120|110,0|0|0,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.1|0|.2,265|300|265,0|0|0,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 3 | 2,2536859.926,708059.4624,1,255|235|215,10|0|10,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.2|.3|.4,265|300|265,1|0|2,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 4 | 3,2532969.44,705413.5711,2,236|235|234,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,0|0|0,265|300|265,20|30|40,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 5 | 4,2539041.489,728416.6747,2,69|69|69,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,1|2|3|,265|300|265,0|0|0,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 6 | 5,2535011.582,720257.8531,3,143|140|137,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.1|0|.2,265|300|265,0|0|0,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 7 | 6,2545325.475,726552.0418,3,119|118|117,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,.2|.3|.4,265|300|265,1|0|2,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 8 | 7,2527429.642,708511.8011,3,158|148|138,10|5|10,150,1,1,random,classvars/ClassVars_AS1.csv,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,0.5|0.5|0.5,Y,1.0|0.5|0.05,N|N|N,0|0|0,100|65|100,10|20|30,8|8|8,0|0|0,265|300|265,20|30|40,N|N|N,N|N|N,1,1,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0|0|0,0.5;0.1 9 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,1,0.01,0.01,0,max,cdmats/Patch7_Probmatrix_Dispersal.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.0539,-6.313,2,random,N,1,1,linear,-445,3.78,N,0,0.5,0,2,2,0.5|0.25|0,random,N,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,temperature,400,0.47,10.5,0.33,-0.075,packing,-0.6821,N,N,0,mating 3 | patchvars/PatchVars_anadromy.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,1,0.01,0.01,0,max,cdmats/Patch7_Probmatrix_Dispersal.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age3,0.0539,-6.313,2,random,N,1,1,linear,-445,3.78,0.62,0,0.5,0,2,2,0.5|0.25|0,random,N,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,temperature,400,0.47,10.5,0.33,-0.075,anadromy,-0.6821,N,N,0,mating 4 | patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,2,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,size300,0.13~0.06,-20.28~-8.09,2,random,N,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs,N,N,0,0,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,logistic,-0.6821,N,N,0,mating 5 | patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,2,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,2,0.01,0.01,0,max,mortality,2,H,0.5,Y,Y,1,1,N,0.13~0.06,-20.28~-8.09,2,random,N,0.5,0.1,exp,126.07,0.0061,0,0,0.5,0,2,2,0,random,N,N,0,Back,N,N,0,0,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,N,-0.6821,N,N,0,mating 6 | -------------------------------------------------------------------------------- /example_files/popvars/PopVarsS1.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,eggFrequency,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVarsS1.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,size300,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,1,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs,N,N,0,0,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,logistic,-0.6821,N,N,0,mating 3 | patchvars/PatchVarsS1.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,N,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,1,exp,126.07,0.0061,0,0,0.5,0,2,2,0,random,N,N,0,Back,N,N,0,0,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,N,-0.6821,N,N,0,mating 4 | patchvars/PatchVarsS1.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,N,Y,1,1,age6,0.0539,-6.313,2,mother,Y,1,0,1,linear,-445,3.78,0,0,50,0,2,2,0,random,N,N,0,N,N,N,0,0,0,Back,N,0,temperature,400,0.47,10.5,0.33,-0.075,logistic,-0.6821,N,N,0,mating 5 | -------------------------------------------------------------------------------- /example_files/popvars/PopVarsS2.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,eggFrequency,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVarsS2.csv,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS2.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,1,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs:Out,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,logistic,-0.6821,N,N,0,mating 3 | patchvars/PatchVarsS2.csv,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS2.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,1,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs:Out,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,N,-0.6821,N,N,0,mating 4 | patchvars/PatchVarsS2.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,N,Y,1,1,age6,0.0539,-6.313,2,mother,Y,1,0,1,linear,-445,3.78,0,0,0.5,0,2,2,0,random,N,N,0,N,N,N,0,20,0,Back,N,0,temperature,400,0.47,10.5,0.33,-0.075,logistic,-0.6821,N,N,0,mating 5 | -------------------------------------------------------------------------------- /example_files/popvars/PopVarsS3.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVarsS3.csv,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS2.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs:Out,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,logistic,-0.6821,N,N,0,mating 3 | patchvars/PatchVarsS3.csv,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS2.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS2.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs:Out,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,N,-0.6821,N,N,0,mating 4 | patchvars/PatchVarsS3.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,max~max,cdmats/Patch7_CdmatrixS1.csv,6,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,N,Y,1,1,age6,0.0539,-6.313,2,mother,Y,1,0,linear,-445,3.78,0,0,0.5,0,2,2,0,random,N,N,0,N,N,N,0,20,0,Back,N,0,temperature,400,0.47,10.5,0.33,-0.075,logistic,-0.6821,N,N,0,mating 5 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_AddFyy.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_AddFyy.csv,cdmats/Patch7_CdmatrixS1.csv,4|1,1.346,202.4846,1,6000|max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv|cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,max~max~max~50max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,4,Y,N,Y,Y,1,1,age6~size100~age6~size100,0.13~0.06~0.13~0.06,-20.28~-8.09~-20.28~-8.09,2,mother,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,3,5,0,random,N,N,0,Eggs,N,N,0,20,0,Back,N,1.5,temperature,250~250~150~150,0.57,12,0.25,-0.196,packing,-0.6821,N,N,0,mating 3 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_AddMyy.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_AddMyy.csv,cdmats/Patch7_CdmatrixS1.csv,4|1,1.346,202.4846,1,6000|max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv|cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv~cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,max~max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,3,Y,N,Y,Y,1,1,age6~size100~age6,0.13~0.06~0.13,-20.28~-8.09~-20.28,2,mother,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,3,5,0,random,N,N,0,Eggs,N,N,0,20,0,Back,N,1.5,temperature,250~250~150,0.57,12,0.25,-0.196,packing,-0.6821,N,N,0,mating 3 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_Climate.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_Climate.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_Probmatrix.csv|cdmats/Patch7_Probmatrix_onewayBarriers.csv|cdmats/Patch7_Probmatrix.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,packing,-0.6821,N,N,0,mating 3 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_IntroducePopulation.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_IntroducePopulation.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,exp,126.07,0.0061,0.61,0.18,0.5,0,2,2,0,random,N,N,0,Eggs,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,packing,-0.6821,N,N,0,mating 3 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_MultiClassvars.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_length_set,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_MultiClassvars.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,N~N,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,3,5,0,random,N,N,0,Eggs,N,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,packing,-0.6821,N,N,0,mating 3 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_bat.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_bat.csv,cdmats/Patch7_CdmatrixS1.csv,6,0,0,0,0,cdmats/Patch7_CdmatrixS1.csv,4,0,0,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0,0,0,max,cdmats/Patch7_CdmatrixS1.csv,1,0,0,0,max,cdmats/Patch7_CdmatrixS1.csv,1,0,0,0,max,mortality,2,Y,N,Y,Y,1,1,age1,0,0,3,random,Y,1,0,linear,0,0,0,0,0.5,0,2,2,0,random,Y,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,N,400,0,0,0,0,logistic,-0.6821,N,N,0,nonmating 3 | -------------------------------------------------------------------------------- /example_files/popvars/PopVars_testMloci.csv: -------------------------------------------------------------------------------- 1 | xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add 2 | patchvars/PatchVars_X3.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,6,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,1,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.13~0.06,-20.28~-8.09,2,random,Y,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,7,2,0,random,N,P_X3_L3_A2_ModelX,0,Out,otherfiles/betafiles/betaFile_3X3L2A.csv,N,0,20,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,packing,-0.6821,N,N,0,mating 3 | -------------------------------------------------------------------------------- /src/CDmetaPOP.py: -------------------------------------------------------------------------------- 1 | # CDmetaPOP.py 2 | # Author: Erin L Landguth / Casey Day 3 | # Created: February 2008 4 | # v 1.0 Release: MARCH 2014 5 | # v 2.0: May 2020 6 | # ---------------------------------------------------------------------------- 7 | # General CDmetaPOP in3formation 8 | appName = "CDmetaPOP" 9 | appVers = "version 2.76" 10 | appRele = "2024.10.08-09:09:09" 11 | authorNames = "Erin L Landguth, Casey Day, Andrew Bearlin, Ryan Simmons, Travis Seaborn, et al." 12 | 13 | # --------------- 14 | # Global symbols 15 | #---------------- 16 | # when set True, routes session log traffic to BOTH the 17 | # screen and to the log file. When False, log traffic just 18 | # sent to log file alone. 19 | msgVerbose = False 20 | # File absolute paths for importing functions 21 | SRC_PATH = "../src/" 22 | 23 | # ------------------------------------------ 24 | # Import Modules with Except/Try statements 25 | # ------------------------------------------ 26 | # Python specific functions 27 | import datetime,time,pdb,os,sys,shutil,gc,warnings 28 | 29 | # For parallel processing 30 | from multiprocessing import Process 31 | from multiprocessing import Queue 32 | import multiprocessing 33 | import numpy as np 34 | 35 | #Import the package specific folders 36 | CDPOP_folder = os.path.dirname(os.path.abspath(SRC_PATH+"CDmetaPOP")) 37 | 38 | if CDPOP_folder not in sys.path: 39 | sys.path.insert(0, CDPOP_folder) 40 | 41 | # CDmetaPOP functions 42 | from CDmetaPOP_Modules import * 43 | from CDmetaPOP_PreProcess import * 44 | from CDmetaPOP_mainloop import * 45 | 46 | #------------------------------------------------------------ 47 | # Begin main file execution 48 | #------------------------------------------------------------ 49 | if __name__ == '__main__': 50 | warnings.filterwarnings("ignore") 51 | 52 | # ------------------------------------------------------ 53 | # Start timer, get script arguments, create log writeout 54 | # ------------------------------------------------------ 55 | # Timing events: start 56 | start_time = datetime.datetime.now() 57 | foldertime = int(time.time()) 58 | 59 | # Split PopVars len() assume noproc used 60 | if len(sys.argv) == 4: 61 | datadir = sys.argv[1]+'/' 62 | fileans = datadir+sys.argv[2] 63 | outdir = datadir+sys.argv[3]+str(foldertime)+'/' 64 | 65 | # If user did not specify .rip file 66 | else: 67 | print("User must specify data directory, input file name, and output file directory, e.g., at command line type CDmetaPOP.py ../CDmetaPOP_data/ RunVars.csv exampleout_foldername.") 68 | sys.exit(-1) 69 | 70 | # If .ip file does not exist 71 | if not os.path.exists(fileans): 72 | print(("Cannot find or open runtime inputs file(%s)"%(fileans))) 73 | sys.exit(-1) 74 | 75 | # Create output file directory - will automatically put in the data directory 76 | os.mkdir(outdir) 77 | current_system_pid = os.getpid() # Get parent ID for terminate 78 | 79 | # ------------------------------------ 80 | # Call DoUserInput() 81 | # ------------------------------------ 82 | # Timing events: start 83 | start_time1 = datetime.datetime.now() 84 | 85 | # Call function and store inputvariables 86 | batchVars1,batchVarsIndex,nSimulations = loadFile(fileans,1,',',True) 87 | 88 | # ---------------------------------------- 89 | # Begin Run Looping - assign processors 90 | # ---------------------------------------- 91 | # This loop is defined by the number of rows in RunVars.csv 92 | for irun in range(nSimulations): 93 | 94 | # Timing events: start 95 | start_timeB = datetime.datetime.now() 96 | print(("On run: %s"%(str(irun))+'\n')) 97 | 98 | # Store RunVars Here 99 | popvarsfile = batchVars1['Popvars'][irun].split(';') 100 | sizeans = batchVars1['sizecontrol'][irun] 101 | constMortans = batchVars1['constMortans'][irun] 102 | mcruns = int(batchVars1['mcruns'][irun]) 103 | looptime = int(batchVars1['runtime'][irun]) 104 | nthfile_out = batchVars1['output_years'][irun] 105 | gridformat = batchVars1['gridformat'][irun] 106 | gridsample = batchVars1['gridsampling'][irun] 107 | outputans = str(batchVars1['summaryOutput'][irun]) 108 | cdclimgentimelist = batchVars1['cdclimgentime'][irun] 109 | startcomp = int(batchVars1['startcomp'][irun]) 110 | implementcomp = str(batchVars1['implementcomp'][irun]) 111 | 112 | # ------------------------------------------ 113 | # Error check: Rows in PopVars must be equal 114 | # ------------------------------------------ 115 | storerowno = [] 116 | for ispecies in range(len(popvarsfile)): 117 | temp1,temp2,checkrowno = loadFile(datadir+popvarsfile[ispecies],1,',',True) 118 | storerowno.append(checkrowno) 119 | storerowno = np.asarray(storerowno) 120 | checkunique = np.unique(storerowno) 121 | if len(checkunique) != 1: 122 | print('Length of PopVars files do no match.') 123 | sys.exit(-1) 124 | 125 | # ------------------------------------------------------ 126 | # Create Qs for multiprocessing Put/Gets 127 | # ------------------------------------------------------ 128 | XQs = [] # For multiprocessing setup, create empty list to fill with # species Qs 129 | extinctQ = Queue() # To track extinction. If all species extinct, exit system 130 | global_extinctQ = Queue() # To track global extinction 131 | logfHndl = [] 132 | for ispecies in range(len(popvarsfile)): 133 | #Ignore queues if only one species 134 | if len(popvarsfile) > 1: 135 | XQs.append([]) 136 | for ispecies2 in range(len(popvarsfile)): 137 | XQs[ispecies].append(Queue()) 138 | 139 | # This properly names log file 140 | logSessionPath = outdir+"CDmetaPOP"+str(ispecies)+".log" 141 | logfHndl.append(open(logSessionPath,'a')) 142 | 143 | msgVerbose = True 144 | logMsg(logfHndl[ispecies],"\n%s Release %s Version %s\n"%(appName,appRele,appVers)) 145 | logMsg(logfHndl[ispecies],"Author(s): %s"%(authorNames)+'\n') 146 | logMsg(logfHndl[ispecies],"Session runtime inputs from: %s"%(fileans)+'\n\n') 147 | logMsg(logfHndl[ispecies],"Session popvars inputs from: %s"%(popvarsfile[ispecies])+'\n\n') 148 | logMsg(logfHndl[ispecies],"On run: %s"%(str(irun))+'\n\n') 149 | logfHndl[ispecies].close() # in order to write out above 150 | msgVerbose = False 151 | 152 | # -------------------------------------- 153 | # Split processors here len(popvarsfile) 154 | # -------------------------------------- 155 | #pdb.set_trace() 156 | if len(popvarsfile) > multiprocessing.cpu_count(): 157 | print("PopVars files given greater than number of CPUs.") 158 | sys.exit(-1) 159 | sp = [] # list of processes for appending 160 | __spec__ = None #This is a fix for an Ipython error that was looking for this variable when using multiprocessing 161 | if len(popvarsfile) > 1: 162 | 163 | for ispecies in range(len(popvarsfile)): 164 | # Need to create target function main_loop 165 | sp.append(Process(target=main_loop, name='S'+str(ispecies), args=(ispecies,datadir+popvarsfile[ispecies],irun,datadir,sizeans,constMortans,mcruns,looptime,nthfile_out,gridformat,gridsample,outputans,cdclimgentimelist,outdir,startcomp,implementcomp,outdir+"CDmetaPOP"+str(ispecies)+".log",XQs, len(popvarsfile), extinctQ, global_extinctQ,current_system_pid))) 166 | # Now Start Processes 167 | for ispecies in range(len(popvarsfile)): 168 | sp[ispecies].start() 169 | # Now Join Processes 170 | for ispecies in range(len(popvarsfile)): 171 | sp[ispecies].join() 172 | elif len(popvarsfile) == 1: 173 | main_loop(0,datadir+popvarsfile[0],irun,datadir,sizeans,constMortans,mcruns,looptime,nthfile_out,gridformat,gridsample,outputans,cdclimgentimelist,outdir,startcomp,implementcomp,outdir+"CDmetaPOP0.log",XQs, len(popvarsfile), extinctQ, global_extinctQ,current_system_pid) 174 | 175 | # Close the logfHndl file 176 | for ispecies in range(len(popvarsfile)): 177 | logfHndl[ispecies].close() 178 | #End::Batch Loop 179 | 180 | # End::Main Loop 181 | 182 | -------------------------------------------------------------------------------- /src/CDmetaPOP_Emigration.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_Emigration.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_Immigration.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_Immigration.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_Mate.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_Mate.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_Modules.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_Modules.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_Mortality.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_Mortality.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_PostProcess.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_PostProcess.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_PreProcess.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_PreProcess.pyc -------------------------------------------------------------------------------- /src/CDmetaPOP_mainloop.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/CDmetaPOP_mainloop.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Emigration.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Emigration.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Emigration.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Emigration.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Emigration.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Emigration.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Immigration.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Immigration.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Immigration.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Immigration.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Immigration.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Immigration.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Mate.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Mate.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Mate.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Mate.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Mate.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Mate.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Modules.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Modules.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Modules.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Modules.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Modules.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Modules.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Mortality.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Mortality.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Mortality.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Mortality.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Mortality.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Mortality.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Offspring.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Offspring.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Offspring.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Offspring.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Offspring2.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Offspring2.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_Offspring2.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_Offspring2.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_PostProcess.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_PostProcess.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_PostProcess.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_PostProcess.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_PostProcess.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_PostProcess.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_PreProcess.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_PreProcess.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_PreProcess.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_PreProcess.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_PreProcess.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_PreProcess.cpython-38.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_mainloop.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_mainloop.cpython-312.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_mainloop.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_mainloop.cpython-37.pyc -------------------------------------------------------------------------------- /src/__pycache__/CDmetaPOP_mainloop.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalEcologyLab/CDMetaPOP/5d451117879e4526ff2584d648c986b3cab636ef/src/__pycache__/CDmetaPOP_mainloop.cpython-38.pyc -------------------------------------------------------------------------------- /src/post_analysis_scripts/GeneticDistancev0.99.14.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # v0.99.14 - 2015July - Create version for CDmetaPOP 3 | # v7.0 - 2014Sept - NAs ignored and calculate a ED matrix at every time step. Speed up with numby intersection 4 | # v6.0 - 2014April -- NAs ignored. 5 | # v5.0 - 2012April5 -- Will calculate on specified generations. 6 | # v4.0 - 2012March29 -- Will list folders in directory. Will not 7 | # work for NA. 8 | # v3.0 - 2011June27 -- Assumes files in grid*.csv, but for new version of 9 | # CDPOP v1.0. Just Dps. 10 | # v2.0 - 2008Dec22 -- Assumes files are in the gridNNN format, but reads in 11 | # *.csv, not grid*.csv 12 | # v1.0 - March 2008 -- Assumes files are named grid*.csv 13 | # GeneticDistance.py 14 | # Author: Erin L Landguth 15 | # Created: March 2008 16 | # Description: This program calculates a genetic distance matrix using: 17 | # Bray-Curtis Method: 18 | # formula 1 - 2W/(A+B), where W is the minimum value between the two comp- 19 | # arison's A and B. The specific application is to calculate this distance 20 | # matrix for genotypes of a population with n individuals: Genetic Distance. 21 | # Proportion of Shared Alleles: 22 | # Nei's: 23 | # 1 - sqrt(ithfreq*jthfreq)/loci 24 | # Proportion of Shared alleles: 25 | # 1 - proportion of shared alleles between individuals. 26 | # Program Input: directory of *.csv files 27 | # Program Output: oldname+Gdmatrix.csv 28 | # Program Steps: 29 | # 1. User input information. 30 | # 2. fileList all of the *.csv in directory 31 | # 3. Run genetic distance method 32 | # ---------------------------------------------------------------------------- 33 | 34 | import glob # The power of glob 35 | # Import statements 36 | try: 37 | import numpy as np 38 | from numpy.random import * 39 | except ImportError: 40 | raise ImportError, "Numpy required." 41 | import time, datetime,os,pdb # Other libraries 42 | 43 | # Timing events: start 44 | start_time = datetime.datetime.now() 45 | 46 | # ------------------------------------------ 47 | # Step 1: Get user information 48 | # ------------------------------------------ 49 | 50 | # Store directory path name 51 | directory = 'D:/projects/CDmetaPOP/BullTrout/Results/Gen-1_indfiles_riverine/test/' 52 | 53 | # Sample the loci to run analysis on (for loci under selection) 54 | loci = 14 55 | #selloci = xrange(1,20) 56 | #selloci = xrange(0,1) 57 | selloci = xrange(loci) 58 | 59 | # Number of alleles per locus 60 | noalleperlocus = 34 61 | alleles = int(noalleperlocus)*np.ones(loci,int) 62 | # If variable alleles per locus 63 | #alleles = array([6,10]) 64 | 65 | # The number of individuals 66 | nogrids = 1587 67 | 68 | # The generations to run 69 | gen = range(21,101,1) 70 | gen = [-1] 71 | 72 | # ------------------------------- 73 | # Step 2: List files in directory 74 | # ------------------------------- 75 | # List folders in this dir 76 | def listdirs(folder): 77 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 78 | folderList = listdirs(directory) 79 | 80 | # Loop through folderList 81 | for ifold in xrange(len(folderList)): 82 | 83 | # ----------------------------------- 84 | # Step 3: Run genetic distance method 85 | # ----------------------------------- 86 | 87 | # ------------ Genetic Distance Matrix: Proportion of shared alleles ----------------------- 88 | # List all files with .csv extensions (but only the grid ones) 89 | 90 | print '\n' 91 | print 'Creating the proportion of shared alleles genetic distance matrices...' 92 | 93 | # Get the first globbed file read in 94 | for i in xrange(len(gen)): 95 | 96 | # Open file for reading 97 | inputfile = open(folderList[ifold]+'/ind'+str(gen[i])+'.csv','r') 98 | 99 | # Read lines from the file 100 | lines = inputfile.readlines() 101 | 102 | #Close the file 103 | inputfile.close() 104 | 105 | # Create an empty matrix to append to 106 | x = [] 107 | 108 | # Split up each line in file and append to empty matrix, x 109 | for l in lines: 110 | thisline = l.split(',') 111 | x.append(thisline) 112 | 113 | # Store genetic information: genes[bear], but need them as float values 114 | Xvals = [] # Read in x and y 115 | Yvals = [] 116 | genes = [] 117 | tempcount = 0 118 | for k in range(len(x)-1): 119 | # Check for NA values 120 | if x[1+k][5] != 'NA': 121 | # Read in X,Y 122 | Xvals.append(float(x[k+1][1])) 123 | Yvals.append(float(x[k+1][2])) 124 | # Create spot in genes 125 | #genes.append([]) 126 | # Get list from read in file 127 | genes.append(x[k+1][13:int(13+np.sum(alleles))]) 128 | tempcount = tempcount + 1 129 | 130 | # Create a matrix of zeros to be filled 131 | gendmatrix = np.zeros((tempcount,tempcount),float) 132 | geodmatrix = np.zeros((tempcount,tempcount),float) 133 | 134 | # Loop through each individual k 135 | for k in range(tempcount): 136 | tempK = np.asarray(genes[k],dtype=int) 137 | # Compare individual k to every other inidividual j 138 | for j in range(tempcount): 139 | tempJ = np.asarray(genes[j],dtype=int) 140 | # Create a tempvariable to be written over for each comparison 141 | tempmin=[] 142 | 143 | tempK_2 = np.where(tempK==2)[0] 144 | tempK_1 = np.where(tempK==1)[0] 145 | tempJ_2 = np.where(tempJ==2)[0] 146 | tempJ_1 = np.where(tempJ==1)[0] 147 | 148 | # Find the shared alleles between k and j checking the 4 conditions 149 | 150 | # Condition 2, 2 151 | tempmin.append(sum(np.in1d(tempK_2,tempJ_2)*2)) 152 | # Condition 2,1 153 | tempmin.append(sum(np.in1d(tempK_2,tempJ_1)*1)) 154 | # Condition 1,2 155 | tempmin.append(sum(np.in1d(tempK_1,tempJ_2)*1)) 156 | # Condition 1,1 157 | tempmin.append(sum(np.in1d(tempK_1,tempJ_1)*1)) 158 | 159 | # Write the Dps value to gendmatrix 160 | gendmatrix[k][j] = 1-float(np.nansum(tempmin))/(2*loci) 161 | 162 | geodmatrix[k][j] = float(np.sqrt((Xvals[k]-Xvals[j])**2+(Yvals[k]-Yvals[j])**2)) 163 | 164 | # Strip directory/filename of grid and add 'Gdmatrix.csv' 165 | gdpathname = folderList[ifold]+'/Gdmatrix'+str(gen[i])+'.csv' 166 | geopathname = folderList[ifold]+'/Edmatrix'+str(gen[i])+'.csv' 167 | 168 | # Create file to write matrix to 169 | outputfile = open(gdpathname,'w') 170 | # Sequence each row in the matrix 171 | for seqrow in gendmatrix: 172 | # Grab each element in each row and write element to outputfile 173 | for ele in range(len(seqrow)): 174 | outputfile.write(str(seqrow[ele])) 175 | # Add comma 176 | outputfile.write(',') 177 | # Return line 178 | outputfile.write('\n') 179 | # Close file 180 | outputfile.close() 181 | # Create file to write matrix to 182 | outputfile = open(geopathname,'w') 183 | # Sequence each row in the matrix 184 | for seqrow in geodmatrix: 185 | # Grab each element in each row and write element to outputfile 186 | for ele in range(len(seqrow)): 187 | outputfile.write(str(seqrow[ele])) 188 | # Add comma 189 | outputfile.write(',') 190 | # Return line 191 | outputfile.write('\n') 192 | # Close file 193 | outputfile.close() 194 | 195 | print '\n' 196 | print 'The genetic distance matrix '+gdpathname+' and geodistance matrix '+geopathname+' have been created in '+str(datetime.datetime.now() -start_time) 197 | 198 | -------------------------------------------------------------------------------- /src/post_analysis_scripts/genetics_v1.00.py: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # genesvalidate.py 3 | # 2014 10 09: Erin Landguth 4 | # This script grabs output.csv files, splits bars, and grabs diagnostics for checking CDPOP/CDFISH/CDmetaPOP 5 | # v0 - Initial script for He/Ho check 6 | # v1 - Allele plots 7 | # genetics_v098: For plotting He/Ho/Alleles for current version. 8 | # genetics_v099: For current version and add in multiple batches 9 | # v1.00: For current version and added AD plots 10 | # Added F plots. 11 | # ----------------------------------------------------------------------------- 12 | 13 | # Load modules 14 | import os,pdb,pandas 15 | from pylab import * 16 | import scipy as sp 17 | 18 | # Numpy functions 19 | try: 20 | import numpy as np 21 | from numpy.random import * 22 | except ImportError: 23 | raise ImportError, "Numpy required." 24 | 25 | # --------- 26 | # User info 27 | # --------- 28 | dir = "D:/projects/CDmetaPOP/Seattle/Sampling/RivExFutBarr_100max_Straypt01_randomgenes/WCT1384_RivExFutBarr_100max_Straypt01_randomgenes_Riv300years/" 29 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_Landscapes/" 30 | savename = "_GeneticsSummary_landscapes_" 31 | #label = ['100years', '200years', '300years'] 32 | label = ['300years'] 33 | label = ['Riverine', 'Ex-Barrier', 'Fut-Barrier', 'Remove-Barrier'] 34 | plottitle = '' 35 | batchno = 4 36 | linemarks1 = ['k','b','r','g','y','c','m'] 37 | linemarks2 = ['k-.','b-.','r-.','g-.','y-.','c-.','m-.'] 38 | linemarks3 = ['k--','b--','r--','g--','y--','c--','m--'] 39 | 40 | savedpi = 300 41 | qnorm = 1.959964 # For CIs, not in function 42 | gen = 125# Number of years 43 | startgenes = 25 44 | nthfile = range(startgenes,gen,1) 45 | #maxA = 17*11 # loci * alleles 46 | #maxA = 18*9 47 | maxA = 19*36 48 | mcno = 2 # Number of MCs 49 | minY_AD = 0.4 50 | maxY_AD = 0.5 51 | minY_H = 0.50 52 | maxY_H = 0.7 53 | minY_F = 0.0 54 | maxY_F = 0.2 55 | 56 | 57 | 58 | # List folders in this directory 59 | def listdirs(folder): 60 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 61 | folderList = listdirs(dir) 62 | 63 | # --------------------------------- 64 | # Storage variables 65 | # --------------------------------- 66 | 67 | alleles = [] 68 | He = [] 69 | Ho = [] 70 | 71 | # Loop through batches 72 | for ibatch in xrange(batchno): 73 | 74 | alleles.append([]) 75 | He.append([]) 76 | Ho.append([]) 77 | 78 | # Loop through MCs 79 | for imc in xrange(mcno): 80 | 81 | # Open output.csv file in folder 82 | inputfile = open(dir+'batchrun'+str(ibatch)+'mcrun'+str(imc)+'/summary_popAllTime.csv') 83 | 84 | # Read lines from the file 85 | lines = inputfile.readlines() 86 | 87 | #Close the file 88 | inputfile.close() 89 | 90 | # Create an empty matrix to append to 91 | values = [] 92 | 93 | # Split up each line in file and append to empty matrix for generation specified 94 | for i in xrange(len(lines)): 95 | thisline = lines[i].split(',') 96 | values.append(thisline) 97 | 98 | # Delete lines 99 | del(lines) 100 | 101 | alleles[ibatch].append([]) 102 | He[ibatch].append([]) 103 | Ho[ibatch].append([]) 104 | 105 | # Then Loop through generations/time 106 | for iout in xrange(gen): 107 | 108 | alleles[ibatch][imc].append([]) 109 | He[ibatch][imc].append([]) 110 | Ho[ibatch][imc].append([]) 111 | 112 | # Grab all patch values - patch values with total 113 | for j in xrange(len(values[1+iout][31].split('|'))-1): 114 | alleles[ibatch][imc][iout].append(int(values[1+iout][31].split('|')[j])) 115 | He[ibatch][imc][iout].append(float(values[1+iout][32].split('|')[j])) 116 | Ho[ibatch][imc][iout].append(float(values[1+iout][33].split('|')[j])) 117 | 118 | 119 | alleles = np.asarray(alleles) 120 | He = np.asarray(He) 121 | Ho = np.asarray(Ho) 122 | allD = (alleles - 1) / (maxA - 1.) 123 | # 1 - Ho/He 124 | F = 1. - (Ho/He) 125 | 126 | # -------------------------------------------- 127 | # Get mean over Monte Carlosfor each batch run 128 | # -------------------------------------------- 129 | all_m = np.nansum(alleles[:][:],axis=1)/mcno 130 | all_sd = np.std(alleles[:][:],axis=1) 131 | error = qnorm*all_sd/(mcno) 132 | all_l = all_m-error 133 | all_r = all_m+error 134 | all_min = np.min(alleles[:][:],axis=1) 135 | all_max = np.max(alleles[:][:],axis=1) 136 | 137 | He_m = np.nansum(He[:][:],axis=1)/mcno 138 | He_sd = np.std(He[:][:],axis=1) 139 | error = qnorm*He_sd/(mcno) 140 | He_l = He_m-error 141 | He_r = He_m+error 142 | He_min = np.min(He[:][:],axis=1) 143 | He_max = np.max(He[:][:],axis=1) 144 | 145 | Ho_m = np.nansum(Ho[:][:],axis=1)/mcno 146 | Ho_sd = np.std(Ho[:][:],axis=1) 147 | error = qnorm*Ho_sd/(mcno) 148 | Ho_l = Ho_m-error 149 | Ho_r = Ho_m+error 150 | Ho_min = np.min(Ho[:][:],axis=1) 151 | Ho_max = np.max(Ho[:][:],axis=1) 152 | 153 | allD_m = np.nansum(allD[:][:],axis=1)/mcno 154 | allD_sd = np.std(allD[:][:],axis=1) 155 | error = qnorm*allD_sd/(mcno) 156 | allD_l = allD_m-error 157 | allD_r = allD_m+error 158 | 159 | F_m = np.nansum(F[:][:],axis=1)/mcno 160 | F_sd = np.std(F[:][:],axis=1) 161 | error = qnorm*F_sd/(mcno) 162 | F_l = F_m-error 163 | F_r = F_m+error 164 | 165 | # -------------------------------------------------------- 166 | # Plotting 167 | # -------------------------------------------------------- 168 | 169 | # Calculate Non-fisherian rate of loss + noselfing+1 170 | rateofloss_nonfisherian=[] 171 | equ1_Tot=[] 172 | equ1_1 = [] 173 | N = 6317 174 | for i in range(len(nthfile)): 175 | rateofloss_nonfisherian.append(He_m[0][0][0]*exp((-1./(2*N+1))*nthfile[i])) 176 | equ1_Tot.append(He_m[0][0][0]*((1-(1./(2*N+1)))**nthfile[i])) 177 | 178 | # Plot Total He,Ho vs. time 179 | figure() 180 | for ibatch in xrange(batchno): 181 | #plot(nthfile,He_m[ibatch][:,0][nthfile],linemarks1[ibatch],label='Expected Batch '+label[ibatch],ms=10) 182 | plot(nthfile,He_m[ibatch][:,0][nthfile],linemarks1[ibatch],label='He (-- Ho)'+label[ibatch],ms=10) 183 | #plot(time,HeTot_Left,'-.r',ms=10) 184 | #plot(time,HeTot_Right,'-.k',ms=10) 185 | #plot(nthfile,Ho_m[ibatch][:,0][nthfile],linemarks2[ibatch],label=''+label[ibatch],ms=10) 186 | plot(nthfile,Ho_m[ibatch][:,0][nthfile],linemarks2[ibatch],label='',linewidth=2) 187 | #plot(time,HoTot_Left,'-.k',ms=10) 188 | #plot(time,HoTot_Right,'-.k',ms=10) 189 | #plot(nthfile,equ1_Tot,'-k',ms=10,label='Equation 1') 190 | #plot(allD_m[ibatch][:,0][nthfile],linemarks3[ibatch],label='Allelic Diversity Batch '+label[ibatch],ms=10) 191 | 192 | xlabel('generations',fontsize=18) 193 | ylabel('Heterozygosity',fontsize=18) 194 | axis([startgenes,gen,minY_H,maxY_H]) 195 | title(plottitle) 196 | legend(loc=3) 197 | # Updating fontsize on axes 198 | fontsize=16 199 | ax = gca() 200 | for tick in ax.xaxis.get_major_ticks(): 201 | tick.label1.set_fontsize(fontsize) 202 | for tick in ax.yaxis.get_major_ticks(): 203 | tick.label1.set_fontsize(fontsize) 204 | savefig(dir+savename+'HeHo.png',dpi=savedpi) 205 | 206 | # Plot Total F vs. time 207 | figure() 208 | for ibatch in xrange(batchno): 209 | #plot(nthfile,He_m[ibatch][:,0][nthfile],linemarks1[ibatch],label='Expected Batch '+label[ibatch],ms=10) 210 | plot(nthfile,F_m[ibatch][:,0][nthfile],linemarks1[ibatch],label='F'+label[ibatch],ms=10) 211 | #plot(time,HeTot_Left,'-.r',ms=10) 212 | #plot(time,HeTot_Right,'-.k',ms=10) 213 | #plot(nthfile,Ho_m[ibatch][:,0][nthfile],linemarks2[ibatch],label=''+label[ibatch],ms=10) 214 | #plot(nthfile,Ho_m[ibatch][:,0][nthfile],linemarks2[ibatch],label='',linewidth=2) 215 | #plot(time,HoTot_Left,'-.k',ms=10) 216 | #plot(time,HoTot_Right,'-.k',ms=10) 217 | #plot(nthfile,equ1_Tot,'-k',ms=10,label='Equation 1') 218 | #plot(allD_m[ibatch][:,0][nthfile],linemarks3[ibatch],label='Allelic Diversity Batch '+label[ibatch],ms=10) 219 | 220 | xlabel('generations',fontsize=18) 221 | ylabel('F',fontsize=18) 222 | axis([startgenes,gen,minY_F,maxY_F]) 223 | title(plottitle) 224 | legend(loc=3) 225 | # Updating fontsize on axes 226 | fontsize=16 227 | ax = gca() 228 | for tick in ax.xaxis.get_major_ticks(): 229 | tick.label1.set_fontsize(fontsize) 230 | for tick in ax.yaxis.get_major_ticks(): 231 | tick.label1.set_fontsize(fontsize) 232 | savefig(dir+savename+'F.png',dpi=savedpi) 233 | 234 | 235 | # Plot Total AD vs. time 236 | figure() 237 | for ibatch in xrange(batchno): 238 | 239 | plot(nthfile,allD_m[ibatch][:,0][nthfile],linemarks3[ibatch],label=''+label[ibatch],linewidth=2) 240 | 241 | xlabel('generations',fontsize=18) 242 | ylabel('Allelic Diversity',fontsize=18) 243 | axis([startgenes,gen,minY_AD,maxY_AD]) 244 | title(plottitle) 245 | legend(loc=3) 246 | # Updating fontsize on axes 247 | fontsize=16 248 | ax = gca() 249 | for tick in ax.xaxis.get_major_ticks(): 250 | tick.label1.set_fontsize(fontsize) 251 | for tick in ax.yaxis.get_major_ticks(): 252 | tick.label1.set_fontsize(fontsize) 253 | savefig(dir+savename+'AD.png',dpi=savedpi) 254 | 255 | show() -------------------------------------------------------------------------------- /src/post_analysis_scripts/genevalidate_v1.py: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # genesvalidate.py 3 | # 2014 10 09: Erin Landguth 4 | # This script grabs output.csv files, splits bars, and grabs diagnostics for checking CDPOP/CDFISH/CDmetaPOP 5 | # v0 - Initial script for He/Ho check 6 | # v1 - Allele plots 7 | # ----------------------------------------------------------------------------- 8 | 9 | # Load modules 10 | import os,pdb,pandas 11 | from pylab import * 12 | import scipy as sp 13 | 14 | # Numpy functions 15 | try: 16 | import numpy as np 17 | from numpy.random import * 18 | except ImportError: 19 | raise ImportError, "Numpy required." 20 | 21 | # --------- 22 | # User info 23 | # --------- 24 | # Directory locations of folders 25 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/dataWCT373_testPackingInit/testPacking50gens/age0/" 26 | plottitle = 'Age 0' 27 | savename = 'Age0_' 28 | batchno = 0 # batch number to run 29 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/dataWCT373_testPackingInit/testPacking50gens/age1/" 30 | plottitle = 'Age 1' 31 | savename = 'Age1_' 32 | batchno = 1 # batch number to run 33 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/dataWCT373_testPackingInit/testPacking50gens/age2/" 34 | plottitle = 'Age 2' 35 | savename = 'Age2_' 36 | batchno = 2 # batch number to run 37 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/dataWCT373_testPackingInit/testPacking50gens/allage/" 38 | plottitle = 'Age 0-5' 39 | savename = 'Age0to5_' 40 | batchno = 3 # batch number to run 41 | 42 | outdir = "D:/projects/CDmetaPOP/Seattle/Runs/dataWCT373_testPackingInit/testPacking50gens/" 43 | 44 | savedpi = 300 45 | qnorm = 1.959964 # For CIs, not in function 46 | gen = 50 # Number of years 47 | startgenes = 0 48 | nthfile = range(startgenes,gen,1) 49 | maxA = 100 # loci * alleles 50 | mcno = 2 # Number of MCs 51 | 52 | # List folders in this directory 53 | def listdirs(folder): 54 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 55 | folderList = listdirs(dir) 56 | 57 | # --------------------------------- 58 | # Storage variables 59 | # --------------------------------- 60 | 61 | alleles = [] 62 | He = [] 63 | Ho = [] 64 | 65 | # Loop through batches 66 | for ibatch in xrange(1): 67 | 68 | alleles.append([]) 69 | He.append([]) 70 | Ho.append([]) 71 | 72 | # Loop through MCs 73 | for imc in xrange(mcno): 74 | 75 | # Open output.csv file in folder 76 | inputfile = open(dir+'batchrun'+str(batchno)+'mcrun'+str(imc)+'/output.csv') 77 | 78 | # Read lines from the file 79 | lines = inputfile.readlines() 80 | 81 | #Close the file 82 | inputfile.close() 83 | 84 | # Create an empty matrix to append to 85 | values = [] 86 | 87 | # Split up each line in file and append to empty matrix for generation specified 88 | for i in xrange(len(lines)): 89 | thisline = lines[i].split(',') 90 | values.append(thisline) 91 | 92 | # Delete lines 93 | del(lines) 94 | 95 | alleles[ibatch].append([]) 96 | He[ibatch].append([]) 97 | Ho[ibatch].append([]) 98 | 99 | # Then Loop through generations/time 100 | for iout in xrange(gen): 101 | 102 | alleles[ibatch][imc].append([]) 103 | He[ibatch][imc].append([]) 104 | Ho[ibatch][imc].append([]) 105 | 106 | # Grab all patch values - patch values with total 107 | for j in xrange(len(values[1+iout][30].split('|'))-1): 108 | alleles[ibatch][imc][iout].append(int(values[1+iout][29].split('|')[j])) 109 | He[ibatch][imc][iout].append(float(values[1+iout][30].split('|')[j])) 110 | Ho[ibatch][imc][iout].append(float(values[1+iout][31].split('|')[j])) 111 | 112 | 113 | alleles = np.asarray(alleles) 114 | He = np.asarray(He) 115 | Ho = np.asarray(Ho) 116 | allD = (alleles - 1) / (maxA - 1.) 117 | 118 | # -------------------------------------------- 119 | # Get mean over Monte Carlosfor each batch run 120 | # -------------------------------------------- 121 | all_m = np.nansum(alleles[:][:],axis=1)/mcno 122 | all_sd = np.std(alleles[:][:],axis=1) 123 | error = qnorm*all_sd/(mcno) 124 | all_l = all_m-error 125 | all_r = all_m+error 126 | all_min = np.min(alleles[:][:],axis=1) 127 | all_max = np.max(alleles[:][:],axis=1) 128 | 129 | He_m = np.nansum(He[:][:],axis=1)/mcno 130 | He_sd = np.std(He[:][:],axis=1) 131 | error = qnorm*He_sd/(mcno) 132 | He_l = He_m-error 133 | He_r = He_m+error 134 | He_min = np.min(He[:][:],axis=1) 135 | He_max = np.max(He[:][:],axis=1) 136 | 137 | Ho_m = np.nansum(Ho[:][:],axis=1)/mcno 138 | Ho_sd = np.std(Ho[:][:],axis=1) 139 | error = qnorm*Ho_sd/(mcno) 140 | Ho_l = Ho_m-error 141 | Ho_r = Ho_m+error 142 | Ho_min = np.min(Ho[:][:],axis=1) 143 | Ho_max = np.max(Ho[:][:],axis=1) 144 | 145 | allD_m = np.nansum(allD[:][:],axis=1)/mcno 146 | allD_sd = np.std(allD[:][:],axis=1) 147 | error = qnorm*allD_sd/(mcno) 148 | allD_l = allD_m-error 149 | allD_r = allD_m+error 150 | 151 | # -------------------------------------------------------- 152 | # Plotting 153 | # -------------------------------------------------------- 154 | 155 | # Calculate Non-fisherian rate of loss + noselfing+1 156 | rateofloss_nonfisherian=[] 157 | equ1_Tot=[] 158 | equ1_1 = [] 159 | N = 1000 160 | for i in range(len(nthfile)): 161 | rateofloss_nonfisherian.append(He_m[0][0][0]*exp((-1./(2*N+1))*nthfile[i])) 162 | equ1_Tot.append(He_m[0][0][0]*((1-(1./(2*N+1)))**nthfile[i])) 163 | 164 | # Plot Total He,Ho vs. time 165 | figure() 166 | plot(nthfile,He_m[0][:,0][nthfile],'k',label='Expected',ms=10) 167 | #plot(time,HeTot_Left,'-.r',ms=10) 168 | #plot(time,HeTot_Right,'-.k',ms=10) 169 | plot(nthfile,Ho_m[0][:,0][nthfile],':k',label='Observed',ms=10) 170 | #plot(time,HoTot_Left,'-.k',ms=10) 171 | #plot(time,HoTot_Right,'-.k',ms=10) 172 | #plot(nthfile,equ1_Tot,'-k',ms=10,label='Equation 1') 173 | xlabel('generations',fontsize=18) 174 | ylabel('Heterozygosity',fontsize=18) 175 | axis([startgenes,gen,0.0,1.0]) 176 | title(plottitle) 177 | legend(loc=3) 178 | # Updating fontsize on axes 179 | fontsize=16 180 | ax = gca() 181 | for tick in ax.xaxis.get_major_ticks(): 182 | tick.label1.set_fontsize(fontsize) 183 | for tick in ax.yaxis.get_major_ticks(): 184 | tick.label1.set_fontsize(fontsize) 185 | savefig(dir+savename+'HeHo.png',dpi=savedpi) 186 | show() -------------------------------------------------------------------------------- /src/post_analysis_scripts/indFormattoGENALEXv1.00.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # indFormattoGENALEX.py 3 | # Author: Erin L Landguth 4 | # Created: Feb 6, 2012 5 | # Updated: Oct 1, 2015 6 | # Description: This program will take the grid{nthfile}.csv genetic information 7 | # files from CDPOP and convert them to the genalex.csv format. 8 | # -------------------------------------------------------------------------------------------------- 9 | 10 | # Numpy functions 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,random,os,sys,glob,datetime,time 17 | from ast import literal_eval 18 | 19 | # --------------------------------------------------------------------------------------------------- 20 | def count_unique(keys): 21 | uniq_keys = np.unique(keys) 22 | bins = uniq_keys.searchsorted(keys) 23 | return uniq_keys, np.bincount(bins) 24 | 25 | #End::count_unique() 26 | 27 | # Timing events: start 28 | start_time = datetime.datetime.now() 29 | 30 | # ------------------------------------ 31 | # Step 1: Get user information 32 | # ------------------------------------ 33 | 34 | # Directory location monte carlo folders - assume all folders to analyze 35 | directory = 'D:/Code/CDMETAPOP/CDmetaPOP_v1.00_20150909/data/testGENEpop1443726228/' 36 | 37 | # Number of loci 38 | loci = 18 39 | 40 | # Number of maximum possible alleles per loci 41 | maxalleles = 9 42 | 43 | # Number of populations 44 | subpopno = 7 45 | 46 | # ------------------------------- 47 | # Step 2: Prelimary work 48 | # ------------------------------- 49 | 50 | # List folders in this dir 51 | def listdirs(folder): 52 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 53 | folderList = listdirs(directory) 54 | 55 | # Create a storage vector for alleles 56 | alleles = maxalleles*np.ones(loci,int) 57 | 58 | # Create a genes vector, appending loci information with alleles to it 59 | genes_genform = [] 60 | for iloci in xrange(loci): 61 | locitemp = np.arange(1,alleles[0]+1,1) 62 | genes_genform.append(list(locitemp)) 63 | 64 | # Begin loop through folders if specificied 65 | for ifolder in xrange(len(folderList)): 66 | 67 | # -------------------------------------- 68 | # Step 3: List files in directory 69 | # -------------------------------------- 70 | datfileList = glob.glob(folderList[ifolder]+'/'+'ind*.csv') 71 | 72 | # Get length of files 73 | nodatfiles = len(datfileList) 74 | 75 | # --------------------------- 76 | # Step 4: Read in file 77 | # --------------------------- 78 | # Loop through each grid 79 | for igrid in xrange(nodatfiles): 80 | 81 | # Grab filename in List 82 | filename = datfileList[igrid] 83 | 84 | # Open file for reading 85 | inputfile = open(filename,'r') 86 | 87 | # Read lines from the file 88 | lines = inputfile.readlines() 89 | 90 | #Close the file 91 | inputfile.close() 92 | 93 | # Create an empty matrix to append to 94 | x = [] 95 | 96 | # Split up each line in file by tab and append to empty matrix, x 97 | for l in lines: 98 | thisline = l.strip('\n').split(',') 99 | x.append(thisline) 100 | 101 | # And grab the number of individuals in file here 102 | nogrids = len(x)-1 103 | 104 | # Get list of subpop numbers for unique counts 105 | subpop_cdpop = [] 106 | for ispot in xrange(nogrids): 107 | subpop_cdpop.append(x[ispot+1][0]) 108 | 109 | # Get the number of individuals in each pop 110 | unipatches = count_unique(subpop_cdpop) 111 | patchN = [] 112 | # loop through all the patches 113 | for ipatch in xrange(subpopno): 114 | 115 | # Where is this patch in the ones that got read in, unipathes, careful of strings and integers. 116 | findno = np.where(unipatches[0]==str(ipatch+1))[0] 117 | 118 | # Check if it was there 119 | if len(findno) != 0: 120 | # Then index into how many patches there 121 | patchN.append(unipatches[1][findno[0]]) 122 | elif len(findno) == 0: 123 | # Then just add in 0 124 | patchN.append(0) 125 | else: 126 | print('Error in genepop file and patch nos.') 127 | sys.exit(-1) 128 | 129 | # Grab the rest of cdpop information appending to patch list 130 | id_cdpop = [] 131 | x_cdpop = [] 132 | y_cdpop = [] 133 | age_cdpop = [] 134 | sex_cdpop = [] 135 | subpop_cdpop = [] 136 | GenFormgenes = [] 137 | # Add spot for each patch 138 | for ipop in xrange(subpopno): 139 | id_cdpop.append([]) 140 | x_cdpop.append([]) 141 | y_cdpop.append([]) 142 | age_cdpop.append([]) 143 | sex_cdpop.append([]) 144 | subpop_cdpop.append([]) 145 | GenFormgenes.append([]) 146 | for ispot in xrange(patchN[ipop]): 147 | # Counter into list x 148 | counter = ispot+sum(patchN[0:ipop]) 149 | subpop_cdpop[ipop].append(x[1+counter][0]) 150 | x_cdpop[ipop].append(float(x[1+counter][1])) 151 | y_cdpop[ipop].append(float(x[1+counter][2])) 152 | id_cdpop[ipop].append(x[1+counter][3]) 153 | sex_cdpop[ipop].append(x[1+counter][4]) 154 | age_cdpop[ipop].append(x[1+counter][5]) 155 | # Genes 156 | GenFormgenes[ipop].append([]) 157 | # Get each genotype 158 | for jspot in xrange(loci): 159 | # Cdpop genes 160 | genes_cdpop = x[1+counter][int(14+sum(alleles[0:jspot])):int(14+sum(alleles[0:jspot+1]))] 161 | 162 | # Add gene individual spot 163 | GenFormgenes[ipop][ispot].append([]) 164 | # Loop through each allele spot at that locus 165 | for ithallele in xrange(alleles[jspot]): 166 | 167 | # Check if allele spot is 1 168 | if int(genes_cdpop[ithallele]) == 1: 169 | # Then store that unique allele number 170 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 171 | 172 | # Check if allele spot is 2 173 | elif int(genes_cdpop[ithallele]) == 2: 174 | # Then store that unique allele number 175 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 176 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 177 | 178 | # Error check 179 | elif int(genes_cdpop[ithallele]) != 0: 180 | print('Something wrong in gene genepop format. Email Erin.') 181 | sys.exit(-1) 182 | 183 | # Delete x variable 184 | del(x) 185 | 186 | # Create file to write matrix to 187 | outputfilename = filename.split('ind') 188 | outputfile = open(outputfilename[0]+'/genalex_ind'+outputfilename[1].strip('.csv')+'.csv','w') 189 | 190 | # Write out the first and second line of GENALEX format 191 | outputfile.write(str(loci)+',') 192 | outputfile.write(str(nogrids)+',') 193 | outputfile.write(str(subpopno)+',') 194 | outputfile.write(str(nogrids)+',') 195 | for i in xrange(loci*alleles[0]): 196 | outputfile.write(',') 197 | outputfile.write('\n') 198 | outputfile.write(filename+',,,,') 199 | for i in xrange(loci*alleles[0]): 200 | outputfile.write(',') 201 | outputfile.write('\n') 202 | 203 | # Write out the third line of GENALEX format 204 | outputfile.write('Individual ID,Population,') 205 | for i in range(loci): 206 | outputfile.write('locus'+str(i+1)+'a,') 207 | outputfile.write('locus'+str(i+1)+'b,') 208 | # The trailing white space and XY information 209 | outputfile.write(',X,Y\n') 210 | 211 | # Loop through each ind spot and output 212 | for ipop in xrange(subpopno): 213 | for ispot in xrange(patchN[ipop]): 214 | 215 | outputfile.write('indiv'+str(ispot)+',') 216 | outputfile.write(str(subpop_cdpop[ipop][ispot])+',') 217 | 218 | # Loop through each locus 219 | for ithloci in xrange(loci): 220 | 221 | # Loop through each allele spot at that locus 222 | for ithallele in xrange(2): 223 | 224 | outputfile.write(str(GenFormgenes[ipop][ispot][ithloci][ithallele])+',') 225 | 226 | # Write out trailing information - white space and x,y information 227 | outputfile.write(',') 228 | outputfile.write(str(x_cdpop[ipop][ispot]).strip('[').strip(']')+',') 229 | outputfile.write(str(y_cdpop[ipop][ispot]).strip('[').strip(']')+'\n') 230 | 231 | # Close file 232 | outputfile.close() 233 | print('GENALEX grid format file conversion complete.') 234 | 235 | print '\n' 236 | print 'Total conversion time for folder',folderList[ifolder],': ',datetime.datetime.now() - start_time -------------------------------------------------------------------------------- /src/post_analysis_scripts/indFormattoGENALEXv1.41.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # indFormattoGENALEX.py 3 | # Author: Erin L Landguth 4 | # Created: Feb 6, 2012 5 | # Updated: Oct 1, 2015 6 | # Description: This program will take the grid{nthfile}.csv genetic information 7 | # files from CDPOP and convert them to the genalex.csv format. 8 | # -------------------------------------------------------------------------------------------------- 9 | 10 | # Numpy functions 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,random,os,sys,glob,datetime,time 17 | from ast import literal_eval 18 | 19 | # --------------------------------------------------------------------------------------------------- 20 | def count_unique(keys): 21 | uniq_keys = np.unique(keys) 22 | bins = uniq_keys.searchsorted(keys) 23 | return uniq_keys, np.bincount(bins) 24 | 25 | #End::count_unique() 26 | 27 | # Timing events: start 28 | start_time = datetime.datetime.now() 29 | 30 | # ------------------------------------ 31 | # Step 1: Get user information 32 | # ------------------------------------ 33 | 34 | # Directory location monte carlo folders - assume all folders to analyze 35 | directory = 'D:/UM/test/' 36 | 37 | # Number of loci 38 | loci = 208 39 | 40 | # Number of maximum possible alleles per loci 41 | maxalleles = 36 42 | 43 | # Number of populations 44 | subpopno = 1 45 | 46 | #Location in ind file for indexing 47 | locus1spot = 17 48 | 49 | # ------------------------------- 50 | # Step 2: Prelimary work 51 | # ------------------------------- 52 | 53 | # List folders in this dir 54 | def listdirs(folder): 55 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 56 | folderList = listdirs(directory) 57 | 58 | # Create a storage vector for alleles 59 | alleles = maxalleles*np.ones(loci,int) 60 | 61 | #Updated for new format with flexible alleles 62 | alleles = np.asarray([17,29,30,12,36,20,25,28,18,11,16,13,13,9,14,13,14,32,13,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]) 63 | 64 | # Create a genes vector, appending loci information with alleles to it 65 | genes_genform = [] 66 | for iloci in xrange(loci): 67 | locitemp = np.arange(1,alleles[iloci]+1,1) 68 | genes_genform.append(list(locitemp)) 69 | 70 | # Begin loop through folders if specificied 71 | for ifolder in xrange(len(folderList)): 72 | 73 | # -------------------------------------- 74 | # Step 3: List files in directory 75 | # -------------------------------------- 76 | datfileList = glob.glob(folderList[ifolder]+'/'+'ind*.csv') 77 | 78 | # Get length of files 79 | nodatfiles = len(datfileList) 80 | 81 | # --------------------------- 82 | # Step 4: Read in file 83 | # --------------------------- 84 | # Loop through each grid 85 | for igrid in xrange(nodatfiles): 86 | 87 | # Grab filename in List 88 | filename = datfileList[igrid] 89 | 90 | # Open file for reading 91 | inputfile = open(filename,'r') 92 | 93 | # Read lines from the file 94 | lines = inputfile.readlines() 95 | 96 | #Close the file 97 | inputfile.close() 98 | 99 | # Create an empty matrix to append to 100 | x = [] 101 | 102 | # Split up each line in file by tab and append to empty matrix, x 103 | for l in lines: 104 | thisline = l.strip('\n').split(',') 105 | x.append(thisline) 106 | 107 | # And grab the number of individuals in file here 108 | nogrids = len(x)-1 109 | 110 | # Get list of subpop numbers for unique counts 111 | subpop_cdpop = [] 112 | for ispot in xrange(nogrids): 113 | subpop_cdpop.append(x[ispot+1][0]) 114 | 115 | # Get the number of individuals in each pop 116 | unipatches = count_unique(subpop_cdpop) 117 | patchN = [] 118 | # loop through all the patches 119 | for ipatch in xrange(subpopno): 120 | 121 | # Where is this patch in the ones that got read in, unipathes, careful of strings and integers. 122 | findno = np.where(unipatches[0]==str(ipatch+1))[0] 123 | 124 | # Check if it was there 125 | if len(findno) != 0: 126 | # Then index into how many patches there 127 | patchN.append(unipatches[1][findno[0]]) 128 | elif len(findno) == 0: 129 | # Then just add in 0 130 | patchN.append(0) 131 | else: 132 | print('Error in genepop file and patch nos.') 133 | sys.exit(-1) 134 | 135 | # Grab the rest of cdpop information appending to patch list 136 | id_cdpop = [] 137 | x_cdpop = [] 138 | y_cdpop = [] 139 | age_cdpop = [] 140 | sex_cdpop = [] 141 | subpop_cdpop = [] 142 | GenFormgenes = [] 143 | # Add spot for each patch 144 | for ipop in xrange(subpopno): 145 | id_cdpop.append([]) 146 | x_cdpop.append([]) 147 | y_cdpop.append([]) 148 | age_cdpop.append([]) 149 | sex_cdpop.append([]) 150 | subpop_cdpop.append([]) 151 | GenFormgenes.append([]) 152 | for ispot in xrange(patchN[ipop]): 153 | # Counter into list x 154 | counter = ispot+sum(patchN[0:ipop]) 155 | subpop_cdpop[ipop].append(x[1+counter][0]) 156 | x_cdpop[ipop].append(float(x[1+counter][1])) 157 | y_cdpop[ipop].append(float(x[1+counter][2])) 158 | id_cdpop[ipop].append(x[1+counter][3]) 159 | sex_cdpop[ipop].append(x[1+counter][4]) 160 | age_cdpop[ipop].append(x[1+counter][5]) 161 | # Genes 162 | GenFormgenes[ipop].append([]) 163 | # Get each genotype 164 | for jspot in xrange(loci): 165 | # Cdpop genes 166 | genes_cdpop = x[1+counter][int(locus1spot+sum(alleles[0:jspot])):int(locus1spot+sum(alleles[0:jspot+1]))] 167 | 168 | # Add gene individual spot 169 | GenFormgenes[ipop][ispot].append([]) 170 | # Loop through each allele spot at that locus 171 | for ithallele in xrange(alleles[jspot]): 172 | 173 | # Check if allele spot is 1 174 | if int(genes_cdpop[ithallele]) == 1: 175 | # Then store that unique allele number 176 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 177 | 178 | # Check if allele spot is 2 179 | elif int(genes_cdpop[ithallele]) == 2: 180 | # Then store that unique allele number 181 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 182 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 183 | 184 | # Error check 185 | elif int(genes_cdpop[ithallele]) != 0: 186 | print('Something wrong in gene genepop format. Email Erin.') 187 | sys.exit(-1) 188 | 189 | # Delete x variable 190 | del(x) 191 | 192 | # Create file to write matrix to 193 | outputfilename = filename.split('ind') 194 | outputfile = open(outputfilename[0]+'/genalex_ind'+outputfilename[1].strip('.csv')+'.csv','w') 195 | 196 | # Write out the first and second line of GENALEX format 197 | outputfile.write(str(loci)+',') 198 | outputfile.write(str(nogrids)+',') 199 | outputfile.write(str(subpopno)+',') 200 | outputfile.write(str(nogrids)+',') 201 | for i in xrange(loci*alleles[0]): 202 | outputfile.write(',') 203 | outputfile.write('\n') 204 | outputfile.write(filename+',,,,') 205 | for i in xrange(loci*alleles[0]): 206 | outputfile.write(',') 207 | outputfile.write('\n') 208 | 209 | # Write out the third line of GENALEX format 210 | outputfile.write('Individual ID,Population,') 211 | for i in range(loci): 212 | outputfile.write('locus'+str(i+1)+'a,') 213 | outputfile.write('locus'+str(i+1)+'b,') 214 | # The trailing white space and XY information 215 | outputfile.write(',X,Y\n') 216 | 217 | # Loop through each ind spot and output 218 | for ipop in xrange(subpopno): 219 | for ispot in xrange(patchN[ipop]): 220 | 221 | outputfile.write('indiv'+str(ispot)+',') 222 | outputfile.write(str(subpop_cdpop[ipop][ispot])+',') 223 | 224 | # Loop through each locus 225 | for ithloci in xrange(loci): 226 | 227 | # Loop through each allele spot at that locus 228 | for ithallele in xrange(2): 229 | 230 | outputfile.write(str(GenFormgenes[ipop][ispot][ithloci][ithallele])+',') 231 | 232 | # Write out trailing information - white space and x,y information 233 | outputfile.write(',') 234 | outputfile.write(str(x_cdpop[ipop][ispot]).strip('[').strip(']')+',') 235 | outputfile.write(str(y_cdpop[ipop][ispot]).strip('[').strip(']')+'\n') 236 | 237 | # Close file 238 | outputfile.close() 239 | print('GENALEX grid format file conversion complete.') 240 | 241 | print '\n' 242 | print 'Total conversion time for folder',folderList[ifolder],': ',datetime.datetime.now() - start_time -------------------------------------------------------------------------------- /src/post_analysis_scripts/indFormattoGENEPOPv1.00.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # indFormattoGENEPOP.py 3 | # Author: Erin L Landguth 4 | # Created: Feb 6, 2012 5 | # Updated: June, 2015 6 | # Description: This program will take the grid{nthfile}.csv genetic information 7 | # files from CDPOP and convert them to the genepop.gen format. 8 | # -------------------------------------------------------------------------------------------------- 9 | 10 | # Numpy functions 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,random,os,sys,glob,datetime,time 17 | from ast import literal_eval 18 | 19 | # --------------------------------------------------------------------------------------------------- 20 | def count_unique(keys): 21 | uniq_keys = np.unique(keys) 22 | bins = uniq_keys.searchsorted(keys) 23 | return uniq_keys, np.bincount(bins) 24 | 25 | #End::count_unique() 26 | 27 | # Timing events: start 28 | start_time = datetime.datetime.now() 29 | 30 | # ------------------------------------ 31 | # Step 1: Get user information 32 | # ------------------------------------ 33 | 34 | # Directory location monte carlo folders - assume all folders to analyze 35 | directory = 'D:/Code/CDMETAPOP/CDmetaPOP_v1.00_20150909/data/testGENEpop1443726228/' 36 | 37 | # Number of loci 38 | loci = 18 39 | 40 | # Number of maximum possible alleles per loci 41 | maxalleles = 9 42 | 43 | # Number of populations 44 | subpopno = 7 45 | 46 | # ------------------------------- 47 | # Step 2: Prelimary work 48 | # ------------------------------- 49 | 50 | # List folders in this dir 51 | def listdirs(folder): 52 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 53 | folderList = listdirs(directory) 54 | 55 | # Create a storage vector for alleles 56 | alleles = maxalleles*np.ones(loci,int) 57 | 58 | # Create a genes vector, appending loci information with alleles to it 59 | genes_genform = [] 60 | for iloci in xrange(loci): 61 | locitemp = np.arange(1,alleles[0]+1,1) 62 | genes_genform.append(list(locitemp)) 63 | 64 | # Begin loop through folders if specificied 65 | for ifolder in xrange(len(folderList)): 66 | 67 | # -------------------------------------- 68 | # Step 3: List files in directory 69 | # -------------------------------------- 70 | datfileList = glob.glob(folderList[ifolder]+'/'+'ind*.csv') 71 | 72 | # Get length of files 73 | nodatfiles = len(datfileList) 74 | 75 | # --------------------------- 76 | # Step 4: Read in file 77 | # --------------------------- 78 | # Loop through each grid 79 | for igrid in xrange(nodatfiles): 80 | 81 | # Grab filename in List 82 | filename = datfileList[igrid] 83 | 84 | # Open file for reading 85 | inputfile = open(filename,'r') 86 | 87 | # Read lines from the file 88 | lines = inputfile.readlines() 89 | 90 | #Close the file 91 | inputfile.close() 92 | 93 | # Create an empty matrix to append to 94 | x = [] 95 | 96 | # Split up each line in file by tab and append to empty matrix, x 97 | for l in lines: 98 | thisline = l.strip('\n').split(',') 99 | x.append(thisline) 100 | 101 | # And grab the number of individuals in file here 102 | nogrids = len(x)-1 103 | 104 | # Get list of subpop numbers for unique counts 105 | subpop_cdpop = [] 106 | for ispot in xrange(nogrids): 107 | subpop_cdpop.append(x[ispot+1][0]) 108 | 109 | # Get the number of individuals in each pop 110 | unipatches = count_unique(subpop_cdpop) 111 | patchN = [] 112 | # loop through all the patches 113 | for ipatch in xrange(subpopno): 114 | 115 | # Where is this patch in the ones that got read in, unipathes, careful of strings and integers. 116 | findno = np.where(unipatches[0]==str(ipatch+1))[0] 117 | 118 | # Check if it was there 119 | if len(findno) != 0: 120 | # Then index into how many patches there 121 | patchN.append(unipatches[1][findno[0]]) 122 | elif len(findno) == 0: 123 | # Then just add in 0 124 | patchN.append(0) 125 | else: 126 | print('Error in genepop file and patch nos.') 127 | sys.exit(-1) 128 | 129 | # Grab the rest of cdpop information appending to patch list 130 | id_cdpop = [] 131 | x_cdpop = [] 132 | y_cdpop = [] 133 | age_cdpop = [] 134 | sex_cdpop = [] 135 | subpop_cdpop = [] 136 | GenFormgenes = [] 137 | # Add spot for each patch 138 | for ipop in xrange(subpopno): 139 | id_cdpop.append([]) 140 | x_cdpop.append([]) 141 | y_cdpop.append([]) 142 | age_cdpop.append([]) 143 | sex_cdpop.append([]) 144 | subpop_cdpop.append([]) 145 | GenFormgenes.append([]) 146 | for ispot in xrange(patchN[ipop]): 147 | # Counter into list x 148 | counter = ispot+sum(patchN[0:ipop]) 149 | subpop_cdpop[ipop].append(x[1+counter][0]) 150 | x_cdpop[ipop].append(float(x[1+counter][1])) 151 | y_cdpop[ipop].append(float(x[1+counter][2])) 152 | id_cdpop[ipop].append(x[1+counter][3]) 153 | sex_cdpop[ipop].append(x[1+counter][4]) 154 | age_cdpop[ipop].append(x[1+counter][5]) 155 | # Genes 156 | GenFormgenes[ipop].append([]) 157 | # Get each genotype 158 | for jspot in xrange(loci): 159 | # Cdpop genes 160 | genes_cdpop = x[1+counter][int(14+sum(alleles[0:jspot])):int(14+sum(alleles[0:jspot+1]))] 161 | 162 | # Add gene individual spot 163 | GenFormgenes[ipop][ispot].append([]) 164 | # Loop through each allele spot at that locus 165 | for ithallele in xrange(alleles[jspot]): 166 | 167 | # Check if allele spot is 1 168 | if int(genes_cdpop[ithallele]) == 1: 169 | # Then store that unique allele number 170 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 171 | 172 | # Check if allele spot is 2 173 | elif int(genes_cdpop[ithallele]) == 2: 174 | # Then store that unique allele number 175 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 176 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 177 | 178 | # Error check 179 | elif int(genes_cdpop[ithallele]) != 0: 180 | print('Something wrong in gene genepop format. Email Erin.') 181 | sys.exit(-1) 182 | 183 | # Delete x variable 184 | del(x) 185 | 186 | # Create file to write matrix to 187 | outputfilename = filename.split('ind') 188 | outputfile = open(outputfilename[0]+'/genepop_ind'+outputfilename[1].strip('.csv')+'.gen','w') 189 | 190 | # Write out the first and second line of GENEPOP format 191 | outputfile.write(outputfilename[0]+'ind'+outputfilename[1]+'\n') 192 | for i in xrange(loci): 193 | outputfile.write('LOCUS-'+str(i+1)+'\n') 194 | 195 | # Write out the genes of each individual by population 196 | for ipop in xrange(subpopno): 197 | #outputfile.write('POP'+str(ipop+1)+'\n') 198 | outputfile.write('POP\n') 199 | 200 | # Loop through each ind spot and output 201 | for ispot in xrange(patchN[ipop]): 202 | 203 | # Individual ID 204 | outputfile.write(id_cdpop[ipop][ispot]+', ') 205 | 206 | # Loop through each locus 207 | for ithloci in xrange(loci): 208 | templociname = '' 209 | # Loop through each allele spot at that locus 210 | for ithallele in xrange(2): 211 | # Add 100 212 | templociname = templociname + str(GenFormgenes[ipop][ispot][ithloci][ithallele]+100) 213 | 214 | outputfile.write(templociname+' ') 215 | # Return character 216 | outputfile.write('\n') 217 | 218 | # Logging message 219 | stringout = 'The file ind'+outputfilename[0]+'/genepop'+outputfilename[1]+'.gen has been created' 220 | 221 | # Close file 222 | outputfile.close() 223 | print('GENEPOP grid format file conversion complete.') 224 | 225 | print '\n' 226 | print 'Total conversion time for folder',folderList[ifolder],': ',datetime.datetime.now() - start_time -------------------------------------------------------------------------------- /src/post_analysis_scripts/indFormattoGENEPOPv1.41.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # indFormattoGENEPOP.py 3 | # Author: Erin L Landguth 4 | # Created: Feb 6, 2012 5 | # Updated: June, 2015 6 | # Description: This program will take the grid{nthfile}.csv genetic information 7 | # files from CDPOP and convert them to the genepop.gen format. 8 | # -------------------------------------------------------------------------------------------------- 9 | 10 | # Numpy functions 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,random,os,sys,glob,datetime,time 17 | from ast import literal_eval 18 | 19 | # --------------------------------------------------------------------------------------------------- 20 | def count_unique(keys): 21 | uniq_keys = np.unique(keys) 22 | bins = uniq_keys.searchsorted(keys) 23 | return uniq_keys, np.bincount(bins) 24 | 25 | #End::count_unique() 26 | 27 | # Timing events: start 28 | start_time = datetime.datetime.now() 29 | 30 | # ------------------------------------ 31 | # Step 1: Get user information 32 | # ------------------------------------ 33 | 34 | # Directory location monte carlo folders - assume all folders to analyze 35 | directory = 'D:/UM/test/' 36 | 37 | # Number of loci 38 | loci = 208 39 | 40 | # Number of maximum possible alleles per loci 41 | maxalleles = 36 42 | 43 | # Number of populations 44 | subpopno = 415 45 | 46 | # indfile index location for the start of locus 1 allele 1 47 | locus1spot = 20 48 | 49 | # ------------------------------- 50 | # Step 2: Prelimary work 51 | # ------------------------------- 52 | 53 | # List folders in this dir 54 | def listdirs(folder): 55 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 56 | folderList = listdirs(directory) 57 | 58 | # Create a storage vector for alleles 59 | alleles = maxalleles*np.ones(loci,int) 60 | #Updated for new format with flexible alleles 61 | alleles = np.asarray([17,29,30,12,36,20,25,28,18,11,16,13,13,9,14,13,14,32,13,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]) 62 | 63 | # Create a genes vector, appending loci information with alleles to it 64 | genes_genform = [] 65 | for iloci in xrange(loci): 66 | locitemp = np.arange(1,alleles[iloci]+1,1) 67 | genes_genform.append(list(locitemp)) 68 | 69 | # Begin loop through folders if specificied 70 | #pdb.set_trace() 71 | for ifolder in xrange(len(folderList)): 72 | 73 | # -------------------------------------- 74 | # Step 3: List files in directory 75 | # -------------------------------------- 76 | datfileList = glob.glob(folderList[ifolder]+'/'+'ind*.csv') 77 | 78 | # Get length of files 79 | nodatfiles = len(datfileList) 80 | 81 | # --------------------------- 82 | # Step 4: Read in file 83 | # --------------------------- 84 | # Loop through each grid 85 | for igrid in xrange(nodatfiles): 86 | 87 | # Grab filename in List 88 | filename = datfileList[igrid] 89 | 90 | # Open file for reading 91 | inputfile = open(filename,'r') 92 | 93 | # Read lines from the file 94 | lines = inputfile.readlines() 95 | 96 | #Close the file 97 | inputfile.close() 98 | 99 | # Create an empty matrix to append to 100 | x = [] 101 | 102 | # Split up each line in file by tab and append to empty matrix, x 103 | for l in lines: 104 | thisline = l.strip('\n').split(',') 105 | x.append(thisline) 106 | 107 | # And grab the number of individuals in file here 108 | nogrids = len(x)-1 109 | 110 | # Get list of subpop numbers for unique counts 111 | subpop_cdpop = [] 112 | for ispot in xrange(nogrids): 113 | subpop_cdpop.append(x[ispot+1][0]) 114 | 115 | # Get the number of individuals in each pop 116 | unipatches = count_unique(subpop_cdpop) 117 | patchN = [] 118 | # loop through all the patches 119 | for ipatch in xrange(subpopno): 120 | 121 | # Where is this patch in the ones that got read in, unipathes, careful of strings and integers. 122 | findno = np.where(unipatches[0]==str(ipatch+1))[0] 123 | 124 | # Check if it was there 125 | if len(findno) != 0: 126 | # Then index into how many patches there 127 | patchN.append(unipatches[1][findno[0]]) 128 | elif len(findno) == 0: 129 | # Then just add in 0 130 | patchN.append(0) 131 | else: 132 | print('Error in genepop file and patch nos.') 133 | sys.exit(-1) 134 | 135 | # Grab the rest of cdpop information appending to patch list 136 | id_cdpop = [] 137 | x_cdpop = [] 138 | y_cdpop = [] 139 | age_cdpop = [] 140 | sex_cdpop = [] 141 | subpop_cdpop = [] 142 | GenFormgenes = [] 143 | # Add spot for each patch 144 | for ipop in xrange(subpopno): 145 | id_cdpop.append([]) 146 | x_cdpop.append([]) 147 | y_cdpop.append([]) 148 | age_cdpop.append([]) 149 | sex_cdpop.append([]) 150 | subpop_cdpop.append([]) 151 | GenFormgenes.append([]) 152 | for ispot in xrange(patchN[ipop]): 153 | # Counter into list x 154 | counter = ispot+sum(patchN[0:ipop]) 155 | subpop_cdpop[ipop].append(x[1+counter][0]) 156 | x_cdpop[ipop].append(float(x[1+counter][1])) 157 | y_cdpop[ipop].append(float(x[1+counter][2])) 158 | id_cdpop[ipop].append(x[1+counter][3]) 159 | sex_cdpop[ipop].append(x[1+counter][4]) 160 | age_cdpop[ipop].append(x[1+counter][5]) 161 | # Genes 162 | GenFormgenes[ipop].append([]) 163 | # Get each genotype 164 | for jspot in xrange(loci): 165 | # Cdpop genes 166 | genes_cdpop = x[1+counter][int(locus1spot+sum(alleles[0:jspot])):int(locus1spot+sum(alleles[0:jspot+1]))] 167 | 168 | # Add gene individual spot 169 | GenFormgenes[ipop][ispot].append([]) 170 | # Loop through each allele spot at that locus 171 | for ithallele in xrange(alleles[jspot]): 172 | 173 | # Check if allele spot is 1 174 | if int(genes_cdpop[ithallele]) == 1: 175 | # Then store that unique allele number 176 | #if jspot ==4: 177 | #pdb.set_trace() 178 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 179 | 180 | # Check if allele spot is 2 181 | elif int(genes_cdpop[ithallele]) == 2: 182 | # Then store that unique allele number 183 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 184 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 185 | 186 | # Error check 187 | elif int(genes_cdpop[ithallele]) != 0: 188 | print('Something wrong in gene genepop format. Email Erin.') 189 | sys.exit(-1) 190 | 191 | # Delete x variable 192 | del(x) 193 | 194 | # Create file to write matrix to 195 | outputfilename = filename.split('ind') 196 | outputfile = open(outputfilename[0]+'/genepop_ind'+outputfilename[1].strip('.csv')+'.gen','w') 197 | 198 | # Write out the first and second line of GENEPOP format 199 | outputfile.write(outputfilename[0]+'ind'+outputfilename[1]+'\n') 200 | for i in xrange(loci): 201 | outputfile.write('LOCUS-'+str(i+1)+'\n') 202 | 203 | # Write out the genes of each individual by population 204 | for ipop in xrange(subpopno): 205 | #outputfile.write('POP'+str(ipop+1)+'\n') 206 | outputfile.write('POP\n') 207 | 208 | # Loop through each ind spot and output 209 | for ispot in xrange(patchN[ipop]): 210 | 211 | # Individual ID 212 | outputfile.write(id_cdpop[ipop][ispot]+', ') 213 | 214 | # Loop through each locus 215 | for ithloci in xrange(loci): 216 | templociname = '' 217 | # Loop through each allele spot at that locus 218 | for ithallele in xrange(2): 219 | # Add 100 220 | templociname = templociname + str(GenFormgenes[ipop][ispot][ithloci][ithallele]+100) 221 | 222 | outputfile.write(templociname+' ') 223 | # Return character 224 | outputfile.write('\n') 225 | 226 | # Logging message 227 | stringout = 'The file ind'+outputfilename[0]+'/genepop'+outputfilename[1]+'.gen has been created' 228 | 229 | # Close file 230 | outputfile.close() 231 | print('GENEPOP grid format file conversion complete.') 232 | 233 | print '\n' 234 | print 'Total conversion time for folder',folderList[ifolder],': ',datetime.datetime.now() - start_time -------------------------------------------------------------------------------- /src/post_analysis_scripts/indFormattoGENEPOPv2.39.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # indFormattoGENEPOP.py 3 | # Author: Erin L Landguth 4 | # Created: Feb 6, 2012 5 | # Updated: June, 2015 6 | # Description: This program will take the grid{nthfile}.csv genetic information 7 | # files from CDPOP and convert them to the genepop.gen format. 8 | # -------------------------------------------------------------------------------------------------- 9 | 10 | # Numpy functions 11 | import pdb,random,os,sys,glob,datetime,time 12 | import numpy as np 13 | from ast import literal_eval 14 | 15 | # --------------------------------------------------------------------------------------------------- 16 | def count_unique(keys): 17 | uniq_keys = np.unique(keys) 18 | bins = uniq_keys.searchsorted(keys) 19 | return uniq_keys, np.bincount(bins) 20 | 21 | #End::count_unique() 22 | 23 | # Timing events: start 24 | start_time = datetime.datetime.now() 25 | 26 | # ------------------------------------ 27 | # Step 1: Get user information 28 | # ------------------------------------ 29 | 30 | # Directory location monte carlo folders - assume all folders to analyze 31 | directory = 'D:/projects/CDmetaPOP/WCT_DGS2018/runs/Model8/' 32 | #directory = 'C:/Users/erin.landguth/Documents/GitHub/CDMetaPOP_MultiSpecies/data_multispecies_example/testBackAGESelection_1647279980/' 33 | 34 | # Number of loci 35 | loci = 206 36 | 37 | # Number of maximum possible alleles per loci 38 | maxalleles = 22 39 | 40 | # Number of populations 41 | subpopno = 415 42 | 43 | # indfile index location for the start of locus 1 allele 1 44 | locus1spot = 18 45 | 46 | # ------------------------------- 47 | # Step 2: Prelimary work 48 | # ------------------------------- 49 | 50 | # List folders in this dir 51 | def listdirs(folder): 52 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 53 | folderList = listdirs(directory) 54 | 55 | # Create a storage vector for alleles 56 | alleles = maxalleles*np.ones(loci,int) 57 | #Updated for new format with flexible alleles 58 | alleles = np.asarray([2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,13,21,22,9,22,17,16,21,13,4,8,7,13,6,13,8,8,16,10]) 59 | 60 | # Create a genes vector, appending loci information with alleles to it 61 | genes_genform = [] 62 | for iloci in range(loci): 63 | locitemp = np.arange(1,alleles[iloci]+1,1) 64 | genes_genform.append(list(locitemp)) 65 | 66 | # Begin loop through folders if specificied 67 | #pdb.set_trace() 68 | for ifolder in range(len(folderList)): 69 | 70 | # -------------------------------------- 71 | # Step 3: List files in directory 72 | # -------------------------------------- 73 | datfileList = glob.glob(folderList[ifolder]+'/'+'ind*.csv') 74 | 75 | # Get length of files 76 | nodatfiles = len(datfileList) 77 | 78 | # --------------------------- 79 | # Step 4: Read in file 80 | # --------------------------- 81 | # Loop through each grid 82 | for igrid in range(nodatfiles): 83 | 84 | # Grab filename in List 85 | filename = datfileList[igrid] 86 | 87 | # Open file for reading 88 | inputfile = open(filename,'r') 89 | 90 | # Read lines from the file 91 | lines = inputfile.readlines() 92 | 93 | #Close the file 94 | inputfile.close() 95 | 96 | # Create an empty matrix to append to 97 | x = [] 98 | 99 | # Split up each line in file by tab and append to empty matrix, x 100 | for l in lines: 101 | thisline = l.strip('\n').split(',') 102 | x.append(thisline) 103 | 104 | # And grab the number of individuals in file here 105 | nogrids = len(x)-1 106 | 107 | # Get list of subpop numbers for unique counts 108 | subpop_cdpop = [] 109 | for ispot in xrange(nogrids): 110 | subpop_cdpop.append(x[ispot+1][0]) 111 | 112 | # Get the number of individuals in each pop 113 | unipatches = count_unique(subpop_cdpop) 114 | patchN = [] 115 | # loop through all the patches 116 | for ipatch in xrange(subpopno): 117 | 118 | # Where is this patch in the ones that got read in, unipathes, careful of strings and integers. 119 | findno = np.where(unipatches[0]==str(ipatch+1))[0] 120 | 121 | # Check if it was there 122 | if len(findno) != 0: 123 | # Then index into how many patches there 124 | patchN.append(unipatches[1][findno[0]]) 125 | elif len(findno) == 0: 126 | # Then just add in 0 127 | patchN.append(0) 128 | else: 129 | print('Error in genepop file and patch nos.') 130 | sys.exit(-1) 131 | 132 | # Grab the rest of cdpop information appending to patch list 133 | id_cdpop = [] 134 | x_cdpop = [] 135 | y_cdpop = [] 136 | age_cdpop = [] 137 | sex_cdpop = [] 138 | subpop_cdpop = [] 139 | GenFormgenes = [] 140 | # Add spot for each patch 141 | for ipop in xrange(subpopno): 142 | id_cdpop.append([]) 143 | x_cdpop.append([]) 144 | y_cdpop.append([]) 145 | age_cdpop.append([]) 146 | sex_cdpop.append([]) 147 | subpop_cdpop.append([]) 148 | GenFormgenes.append([]) 149 | for ispot in xrange(patchN[ipop]): 150 | # Counter into list x 151 | counter = ispot+sum(patchN[0:ipop]) 152 | subpop_cdpop[ipop].append(x[1+counter][0]) 153 | x_cdpop[ipop].append(float(x[1+counter][1])) 154 | y_cdpop[ipop].append(float(x[1+counter][2])) 155 | id_cdpop[ipop].append(x[1+counter][3]) 156 | sex_cdpop[ipop].append(x[1+counter][4]) 157 | age_cdpop[ipop].append(x[1+counter][5]) 158 | # Genes 159 | GenFormgenes[ipop].append([]) 160 | # Get each genotype 161 | for jspot in xrange(loci): 162 | # Cdpop genes 163 | genes_cdpop = x[1+counter][int(locus1spot+sum(alleles[0:jspot])):int(locus1spot+sum(alleles[0:jspot+1]))] 164 | 165 | # Add gene individual spot 166 | GenFormgenes[ipop][ispot].append([]) 167 | # Loop through each allele spot at that locus 168 | for ithallele in xrange(alleles[jspot]): 169 | 170 | # Check if allele spot is 1 171 | if int(genes_cdpop[ithallele]) == 1: 172 | # Then store that unique allele number 173 | #if jspot ==4: 174 | #pdb.set_trace() 175 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 176 | 177 | # Check if allele spot is 2 178 | elif int(genes_cdpop[ithallele]) == 2: 179 | # Then store that unique allele number 180 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 181 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 182 | 183 | # Error check 184 | elif int(genes_cdpop[ithallele]) != 0: 185 | print('Something wrong in gene genepop format. Email Erin.') 186 | sys.exit(-1) 187 | 188 | # Delete x variable 189 | del(x) 190 | 191 | # Create file to write matrix to 192 | outputfilename = filename.split('ind') 193 | outputfile = open(outputfilename[0]+'/genepop_ind'+outputfilename[1].strip('.csv')+'.gen','w') 194 | 195 | # Write out the first and second line of GENEPOP format 196 | outputfile.write(outputfilename[0]+'ind'+outputfilename[1]+'\n') 197 | for i in xrange(loci): 198 | outputfile.write('LOCUS-'+str(i+1)+'\n') 199 | 200 | # Write out the genes of each individual by population 201 | for ipop in xrange(subpopno): 202 | #outputfile.write('POP'+str(ipop+1)+'\n') 203 | outputfile.write('POP\n') 204 | 205 | # Loop through each ind spot and output 206 | for ispot in xrange(patchN[ipop]): 207 | 208 | # Individual ID 209 | outputfile.write(id_cdpop[ipop][ispot]+', ') 210 | 211 | # Loop through each locus 212 | for ithloci in xrange(loci): 213 | templociname = '' 214 | # Loop through each allele spot at that locus 215 | for ithallele in xrange(2): 216 | # Add 100 217 | templociname = templociname + str(GenFormgenes[ipop][ispot][ithloci][ithallele]+100) 218 | 219 | outputfile.write(templociname+' ') 220 | # Return character 221 | outputfile.write('\n') 222 | 223 | # Logging message 224 | stringout = 'The file ind'+outputfilename[0]+'/genepop'+outputfilename[1]+'.gen has been created' 225 | 226 | # Close file 227 | outputfile.close() 228 | print('GENEPOP grid format file conversion complete.\n') 229 | 230 | print('Total conversion time for folder',folderList[ifolder],': ',datetime.datetime.now() - start_time) -------------------------------------------------------------------------------- /src/post_analysis_scripts/indFormattoGENEPOPv2.40.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------------------------- 2 | # indFormattoGENEPOP.py 3 | # Author: Erin L Landguth 4 | # Created: Feb 6, 2012 5 | # Updated: June, 2015 6 | # Description: This program will take the grid{nthfile}.csv genetic information 7 | # files from CDPOP and convert them to the genepop.gen format. 8 | # -------------------------------------------------------------------------------------------------- 9 | 10 | # Numpy functions 11 | import pdb,random,os,sys,glob,datetime,time 12 | import numpy as np 13 | from ast import literal_eval 14 | 15 | # --------------------------------------------------------------------------------------------------- 16 | def count_unique(keys): 17 | uniq_keys = np.unique(keys) 18 | bins = uniq_keys.searchsorted(keys) 19 | return uniq_keys, np.bincount(bins) 20 | 21 | #End::count_unique() 22 | 23 | # Timing events: start 24 | start_time = datetime.datetime.now() 25 | 26 | # ------------------------------------ 27 | # Step 1: Get user information 28 | # ------------------------------------ 29 | 30 | # Directory location monte carlo folders - assume all folders to analyze 31 | directory = 'D:/projects/CDmetaPOP/WCT_DGS2018/runs/Model8/' 32 | #directory = 'C:/Users/erin.landguth/Documents/GitHub/CDMetaPOP_MultiSpecies/data_multispecies_example/testBackAGESelection_1647279980/' 33 | 34 | # Number of loci 35 | loci = 206 36 | 37 | # Number of maximum possible alleles per loci 38 | maxalleles = 22 39 | 40 | # Number of populations 41 | subpopno = 415 42 | 43 | # indfile index location for the start of locus 1 allele 1 44 | locus1spot = 18 45 | 46 | # ------------------------------- 47 | # Step 2: Prelimary work 48 | # ------------------------------- 49 | 50 | # List folders in this dir 51 | def listdirs(folder): 52 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 53 | folderList = listdirs(directory) 54 | 55 | # Create a storage vector for alleles 56 | alleles = maxalleles*np.ones(loci,int) 57 | #Updated for new format with flexible alleles 58 | alleles = np.asarray([2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,13,21,22,9,22,17,16,21,13,4,8,7,13,6,13,8,8,16,10]) 59 | 60 | # Create a genes vector, appending loci information with alleles to it 61 | genes_genform = [] 62 | for iloci in range(loci): 63 | locitemp = np.arange(1,alleles[iloci]+1,1) 64 | genes_genform.append(list(locitemp)) 65 | 66 | # Begin loop through folders if specificied 67 | #pdb.set_trace() 68 | for ifolder in range(len(folderList)): 69 | 70 | # -------------------------------------- 71 | # Step 3: List files in directory 72 | # -------------------------------------- 73 | datfileList = glob.glob(folderList[ifolder]+'/'+'ind*.csv') 74 | 75 | # Get length of files 76 | nodatfiles = len(datfileList) 77 | 78 | # --------------------------- 79 | # Step 4: Read in file 80 | # --------------------------- 81 | # Loop through each grid 82 | for igrid in range(nodatfiles): 83 | 84 | # Grab filename in List 85 | filename = datfileList[igrid] 86 | 87 | # Open file for reading 88 | inputfile = open(filename,'r') 89 | 90 | # Read lines from the file 91 | lines = inputfile.readlines() 92 | 93 | #Close the file 94 | inputfile.close() 95 | 96 | # Create an empty matrix to append to 97 | x = [] 98 | 99 | # Split up each line in file by tab and append to empty matrix, x 100 | for l in lines: 101 | thisline = l.strip('\n').split(',') 102 | x.append(thisline) 103 | 104 | # And grab the number of individuals in file here 105 | nogrids = len(x)-1 106 | 107 | # Get list of subpop numbers for unique counts 108 | subpop_cdpop = [] 109 | for ispot in range(nogrids): 110 | subpop_cdpop.append(x[ispot+1][0]) 111 | 112 | # Get the number of individuals in each pop 113 | unipatches = count_unique(subpop_cdpop) 114 | patchN = [] 115 | # loop through all the patches 116 | for ipatch in range(subpopno): 117 | 118 | # Where is this patch in the ones that got read in, unipathes, careful of strings and integers. 119 | findno = np.where(unipatches[0]==str(ipatch+1))[0] 120 | 121 | # Check if it was there 122 | if len(findno) != 0: 123 | # Then index into how many patches there 124 | patchN.append(unipatches[1][findno[0]]) 125 | elif len(findno) == 0: 126 | # Then just add in 0 127 | patchN.append(0) 128 | else: 129 | print('Error in genepop file and patch nos.') 130 | sys.exit(-1) 131 | 132 | # Grab the rest of cdpop information appending to patch list 133 | id_cdpop = [] 134 | x_cdpop = [] 135 | y_cdpop = [] 136 | age_cdpop = [] 137 | sex_cdpop = [] 138 | subpop_cdpop = [] 139 | GenFormgenes = [] 140 | # Add spot for each patch 141 | for ipop in range(subpopno): 142 | id_cdpop.append([]) 143 | x_cdpop.append([]) 144 | y_cdpop.append([]) 145 | age_cdpop.append([]) 146 | sex_cdpop.append([]) 147 | subpop_cdpop.append([]) 148 | GenFormgenes.append([]) 149 | for ispot in range(patchN[ipop]): 150 | # Counter into list x 151 | counter = ispot+sum(patchN[0:ipop]) 152 | subpop_cdpop[ipop].append(x[1+counter][0]) 153 | x_cdpop[ipop].append(float(x[1+counter][1])) 154 | y_cdpop[ipop].append(float(x[1+counter][2])) 155 | id_cdpop[ipop].append(x[1+counter][3]) 156 | sex_cdpop[ipop].append(x[1+counter][4]) 157 | age_cdpop[ipop].append(x[1+counter][5]) 158 | # Genes 159 | GenFormgenes[ipop].append([]) 160 | # Get each genotype 161 | for jspot in range(loci): 162 | # Cdpop genes 163 | genes_cdpop = x[1+counter][int(locus1spot+sum(alleles[0:jspot])):int(locus1spot+sum(alleles[0:jspot+1]))] 164 | 165 | # Add gene individual spot 166 | GenFormgenes[ipop][ispot].append([]) 167 | # Loop through each allele spot at that locus 168 | for ithallele in range(alleles[jspot]): 169 | 170 | # Check if allele spot is 1 171 | if int(genes_cdpop[ithallele]) == 1: 172 | # Then store that unique allele number 173 | #if jspot ==4: 174 | #pdb.set_trace() 175 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 176 | 177 | # Check if allele spot is 2 178 | elif int(genes_cdpop[ithallele]) == 2: 179 | # Then store that unique allele number 180 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 181 | GenFormgenes[ipop][ispot][jspot].append(genes_genform[jspot][ithallele]) 182 | 183 | # Error check 184 | elif int(genes_cdpop[ithallele]) != 0: 185 | print('Something wrong in gene genepop format. Email Erin.') 186 | sys.exit(-1) 187 | 188 | # Delete x variable 189 | del(x) 190 | 191 | # Create file to write matrix to 192 | outputfilename = filename.split('ind') 193 | outputfile = open(outputfilename[0]+'/genepop_ind'+outputfilename[1].strip('.csv')+'.gen','w') 194 | 195 | # Write out the first and second line of GENEPOP format 196 | outputfile.write(outputfilename[0]+'ind'+outputfilename[1]+'\n') 197 | for i in range(loci): 198 | outputfile.write('LOCUS-'+str(i+1)+'\n') 199 | 200 | # Write out the genes of each individual by population 201 | for ipop in range(subpopno): 202 | #outputfile.write('POP'+str(ipop+1)+'\n') 203 | outputfile.write('POP\n') 204 | 205 | # Loop through each ind spot and output 206 | for ispot in range(patchN[ipop]): 207 | 208 | # Individual ID 209 | outputfile.write(id_cdpop[ipop][ispot]+', ') 210 | 211 | # Loop through each locus 212 | for ithloci in range(loci): 213 | templociname = '' 214 | # Loop through each allele spot at that locus 215 | for ithallele in range(2): 216 | # Add 100 217 | templociname = templociname + str(GenFormgenes[ipop][ispot][ithloci][ithallele]+100) 218 | 219 | outputfile.write(templociname+' ') 220 | # Return character 221 | outputfile.write('\n') 222 | 223 | # Logging message 224 | stringout = 'The file ind'+outputfilename[0]+'/genepop'+outputfilename[1]+'.gen has been created' 225 | 226 | # Close file 227 | outputfile.close() 228 | print('GENEPOP grid format file conversion complete.\n') 229 | 230 | print('Total conversion time for folder',folderList[ifolder],': ',datetime.datetime.now() - start_time) -------------------------------------------------------------------------------- /src/post_analysis_scripts/morteggs.py: -------------------------------------------------------------------------------- 1 | # morteggs.py 2 | # quick normal draw write to file script 3 | # -------------------------------------- 4 | import numpy as np 5 | import pdb 6 | from scipy.stats import truncnorm 7 | from scipy.stats import norm 8 | 9 | datadir = "D:/projects/CDmetaPOP/pop3.csv" 10 | mu = 80 11 | sigma = 10 12 | samp = 50 13 | lower = 0. 14 | upper = 100. 15 | intorfloat = 'float' 16 | 17 | 18 | # Try #1 - baised 19 | s1 = np.random.normal(mu,sigma,samp) 20 | #s1[np.where(s1>100)] = 100. 21 | #s1[np.where(s1<0)] = 0. 22 | 23 | # Try #2 - biased? 24 | s2 = [] 25 | for i in range(samp): 26 | temp = np.random.normal(mu,sigma,1)[0] 27 | while temp < 0 or temp > 100: 28 | temp = np.random.normal(mu,sigma,1)[0] 29 | s2.append(temp) 30 | 31 | # Try #3 - truncnorm 32 | s3 = truncnorm.rvs((lower - mu) / sigma, (upper - mu) / sigma, loc=mu, scale=sigma,size=samp) 33 | 34 | s = s1 35 | 36 | outfile = open(datadir,'w') 37 | for i in xrange(len(s)): 38 | if intorfloat == 'int': 39 | outfile.write(str(int(s[i]))+'\n') 40 | else: 41 | outfile.write(str(round(s[i],2))+'\n') 42 | 43 | outfile.close() 44 | 45 | # Apply the Todd and Ng method. 46 | datadir = "D:/projects/CDmetaPOP/Seattle/GD182.txt" 47 | 48 | # First apply a transformation to mu and sigma 49 | #exp(x) / 1 + exp(x) -------------------------------------------------------------------------------- /src/post_analysis_scripts/plotCDist_v0.py: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------- 2 | # plotCDist_v0.py 3 | # Erin Landguth/Casey Day 4 | # June 15, 2015 5 | # Description: This script reads in CDDist movement column and plots 6 | # histogram to compare movement scenarios 7 | # v0 - Initial script 8 | # ---------------------------------------------------------- 9 | 10 | # Import statements 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,os,copy 17 | from random import * 18 | import pylab as P 19 | 20 | # Functions needed 21 | def count_unique(keys): 22 | uniq_keys = np.unique(keys) 23 | bins = uniq_keys.searchsorted(keys) 24 | return uniq_keys, np.bincount(bins) 25 | 26 | #----------------- 27 | # User Input 28 | #----------------- 29 | # Directory location of output.csv 30 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/data_WCT1384_2016Sampling/WCT2016Nov22_noGenes2x2_6kmMove_modKv3/" 31 | 32 | # Outputname 33 | outname = "_Diagnostics_WCT2016Nov22_noGenes2x2_6kmMove_modKv3_OUT_" 34 | outdir = "D:/projects/CDmetaPOP/Seattle/Runs/data_WCT1384_2016Sampling/WCT2016Nov22_noGenes2x2_6kmMove_modKv3/summary/" 35 | xlabel = 'Probability' 36 | 37 | # batch number - batchrun(batchno)mcrun{mcrun} 38 | batchno = 0 39 | 40 | # MCRun number 41 | mcrun = 0 42 | 43 | # Generations to look at 44 | gen = [100] 45 | 46 | # Which grid files to do ind{}.csv or indSample{}.csv (ind or indSample) 47 | gridformat = 'indSample' 48 | 49 | # ------------------ 50 | # End User Input 51 | # ------------------ 52 | 53 | # List folders in this dir 54 | def listdirs(folder): 55 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 56 | folderList = listdirs(dir) 57 | 58 | cdist = [] 59 | N = [] 60 | Age0s = [] 61 | 62 | # -------------------- 63 | # Begin gen loop 64 | # -------------------- 65 | for igen in xrange(len(gen)): 66 | 67 | cdist.append([]) 68 | N.append([]) 69 | Age0s.append([]) 70 | 71 | # -------------------------- 72 | # Read in information 73 | # -------------------------- 74 | # Open file to extract number of migrants 75 | xyinputfile = open(dir+"batchrun"+str(batchno)+"mcrun"+str(mcrun)+"/"+gridformat+str(gen[igen])+".csv",'r') 76 | 77 | # Read lines from the file 78 | lines = xyinputfile.readlines() 79 | 80 | #Close the file 81 | xyinputfile.close() 82 | 83 | # Create an empty matrix to append to 84 | x = [] 85 | 86 | # Split up each line in file and append to empty matrix for generation specified 87 | for i in xrange(len(lines)): 88 | thisline = lines[i].split(',') 89 | x.append(thisline) 90 | 91 | # Extract values from this grid 92 | for i in xrange(len(x)-1): 93 | cdist[igen].append(float(x[i+1][13])) 94 | N[igen].append(int(x[i+1][0])) 95 | 96 | 97 | # Get N numbers 98 | for igen in xrange(len(gen)): 99 | N[igen] = len(N[igen]) 100 | cdist_temp = np.asarray(cdist[igen],dtype=float) 101 | Age0s[igen].append(len(np.where(cdist_temp==-9999.0)[0])) 102 | 103 | # --------------------- 104 | # Plotting 105 | # --------------------- 106 | for igen in xrange(len(gen)): 107 | cdist_temp = np.asarray(cdist[igen],dtype=float) 108 | cdist_noAge0s = cdist_temp[np.where(cdist_temp!=-9999.0)[0]] 109 | if len(cdist_noAge0s) != 0: 110 | P.figure(igen) 111 | P.hist(cdist_noAge0s, histtype='bar') 112 | P.xlabel(xlabel) 113 | P.title("Year "+str(gen[igen])+"; N_move = "+str(N[igen])+ "; N_nomove = "+str(Age0s[igen][0])) 114 | P.savefig(outdir+outname+'CostDistance_'+str(gen[igen])+'.png',dpi=200) 115 | 116 | P.show() 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /src/post_analysis_scripts/plotRSI_batch_v1.00.py: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # plotRSI.py 3 | # 2015 12 29: Erin Landguth 4 | # This script grabs output.csv files; plots RSI 5 | # v1.00 - For v1.00 files. 6 | # ----------------------------------------------------------------------------- 7 | 8 | # Load modules 9 | import os,pdb,pandas 10 | from pylab import * 11 | import scipy as sp 12 | 13 | # Numpy functions 14 | try: 15 | import numpy as np 16 | from numpy.random import * 17 | except ImportError: 18 | raise ImportError, "Numpy required." 19 | 20 | # --------- 21 | # User info 22 | # --------- 23 | #dir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_MovementDistances/' 24 | plottitle = "" 25 | savename = "_RSI_movethreshold_" 26 | label = ['25% Max', '50% Max', '100% Max'] 27 | linemarks = ['k--','b-o','r-.','g-^','ys-'] 28 | batchno = 3 29 | 30 | dir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_StrayRates/' 31 | plottitle = "" 32 | savename = "_RSI_strayrates_" 33 | label = ['0.001', '0.01', '0.05'] 34 | linemarks = ['k--','b-o','r-.','g-^','ys-'] 35 | batchno = 3 36 | 37 | dir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_Landscapes/' 38 | savename = "_RSI_landscapes_" 39 | label = ['Riverine', 'Ex-Barrier', 'Fut-Barrier','Remove-Barrier'] 40 | batchno = 4 41 | linemarks = ['k--','b-o','r-','g-^','ys-'] 42 | 43 | outdir = dir 44 | 45 | savedpi = 300 46 | qnorm = 1.959964 # For CIs, not in function 47 | gen = 125 # Number of years 48 | nthfile = range(0,gen,1) 49 | #nthfile = np.asarraty([0,1,2,3,4,5,10,19]) 50 | mcno = 2 # Number of MCs 51 | 52 | # List folders in this directory 53 | def listdirs(folder): 54 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 55 | folderList = listdirs(dir) 56 | 57 | # --------------------------------- 58 | # Storage variables 59 | # --------------------------------- 60 | # Store values 61 | R = [] 62 | S1 = [] 63 | S2 = [] 64 | I = [] 65 | N = [] 66 | 67 | # Loop through batches 68 | for ibatch in xrange(batchno): 69 | 70 | # Add storage spot 71 | R.append([]) 72 | S1.append([]) 73 | S2.append([]) 74 | I.append([]) 75 | N.append([]) 76 | 77 | # Loop through MCs 78 | for imc in xrange(mcno): 79 | 80 | # ------------------------------- 81 | # Read in patchAllTime values 82 | # ------------------------------- 83 | # Open output.csv file in folder 84 | inputfile = open(dir+'batchrun'+str(ibatch)+'mcrun'+str(imc)+'/summary_popAllTime.csv') 85 | 86 | # Read lines from the file 87 | lines = inputfile.readlines() 88 | 89 | #Close the file 90 | inputfile.close() 91 | 92 | # Create an empty matrix to append to 93 | values_pop = [] 94 | 95 | # Split up each line in file and append to empty matrix for generation specified 96 | for i in xrange(len(lines)): 97 | thisline = lines[i].split(',') 98 | values_pop.append(thisline) 99 | # Delete lines 100 | del(lines) 101 | 102 | # Store values 103 | R[ibatch].append([]) 104 | S1[ibatch].append([]) 105 | S2[ibatch].append([]) 106 | I[ibatch].append([]) 107 | N[ibatch].append([]) 108 | 109 | # Then Loop through generations/time 110 | for iout in xrange(gen): 111 | 112 | R[ibatch][imc].append([]) 113 | S1[ibatch][imc].append([]) 114 | S2[ibatch][imc].append([]) 115 | I[ibatch][imc].append([]) 116 | N[ibatch][imc].append([]) 117 | 118 | # Grab all patch values - patch values with total 119 | for j in xrange(len(values_pop[1+iout][57].split('|'))-1): 120 | R[ibatch][imc][iout].append(float(values_pop[1+iout][57].split('|')[j])) 121 | S1[ibatch][imc][iout].append(float(values_pop[1+iout][58].split('|')[j])) 122 | S2[ibatch][imc][iout].append(float(values_pop[1+iout][59].split('|')[j])) 123 | I[ibatch][imc][iout].append(float(values_pop[1+iout][60].split('|')[j])) 124 | N[ibatch][imc][iout].append(float(values_pop[1+iout][3].split('|')[j+1])) # Remove total here 125 | 126 | # Turn into arrays 127 | R = np.asarray(R) 128 | S1 = np.asarray(S1) 129 | S2 = np.asarray(S2) 130 | I = np.asarray(I) 131 | N = np.asarray(N) 132 | 133 | # -------------------------------------------- 134 | # Get mean over Monte Carlosfor each batch run 135 | # -------------------------------------------- 136 | N_m = np.nansum(N[:][:],axis=1)/mcno 137 | 138 | R_m = np.nansum(R[:][:],axis=1)/mcno 139 | R_sd = np.std(R[:][:],axis=1) 140 | error = R_sd*qnorm/mcno 141 | R_l = R_m-error 142 | R_r = R_m+error 143 | R_min = np.min(R[:][:],axis=1) 144 | R_max = np.max(R[:][:],axis=1) 145 | 146 | S1_m = np.nansum(S1[:][:],axis=1)/mcno 147 | S1_sd = np.std(S1[:][:],axis=1) 148 | error = S1_sd*qnorm/mcno 149 | S1_l = S1_m-error 150 | S1_r = S1_m+error 151 | S1_min = np.min(S1[:][:],axis=1) 152 | S1_max = np.max(S1[:][:],axis=1) 153 | 154 | S2_m = np.nansum(S2[:][:],axis=1)/mcno 155 | S2_sd = np.std(S2[:][:],axis=1) 156 | error = qnorm*S2_sd/(mcno) 157 | S2_l = S2_m-error 158 | S2_r = S2_m+error 159 | S2_min = np.min(S2[:][:],axis=1) 160 | S2_max = np.max(S2[:][:],axis=1) 161 | 162 | I_m = np.nansum(I[:][:],axis=1)/mcno 163 | I_sd = np.std(I[:][:],axis=1) 164 | error = I_sd*qnorm/mcno 165 | I_l = I_m-error 166 | I_r = I_m+error 167 | I_min = np.min(I[:][:],axis=1) 168 | I_max = np.max(I[:][:],axis=1) 169 | 170 | # -------------------------------- 171 | # Patch mean 172 | # -------------------------------- 173 | 174 | # First remove N=0 locations for averaging 175 | # ---------------------------------------- 176 | 177 | remove0 = np.where(N_m[0][0] != 0)[0] 178 | #remove0 = zip(*np.where(N_m != 0)) 179 | 180 | R_patch_m = np.nansum(R_m,axis=2)/len(remove0) 181 | S1_patch_m = np.nansum(S1_m,axis=2)/len(remove0) 182 | S2_patch_m = np.nansum(S2_m,axis=2)/len(remove0) 183 | I_patch_m = np.nansum(I_m,axis=2)/len(remove0) 184 | N_patch_m = np.nansum(N_m,axis=2)/len(remove0) 185 | 186 | 187 | # -------------------------------------------- 188 | # Write to file 189 | # -------------------------------------------- 190 | 191 | # -------------------------------------------------------- 192 | # Plotting 193 | # -------------------------------------------------------- 194 | 195 | # Plot total RSI through time 196 | # --------------------------- 197 | figure() 198 | for i in xrange(len(R_m)): 199 | plot(nthfile,R_patch_m[i],linemarks[i],label=label[i],linewidth=2) 200 | #plot(nthfile,S1_m[i],linemarks[i],label='S1 '+label[i],linewidth=2) 201 | #plot(nthfile,S2_m[i],linemarks[i],label='S2 '+label[i],linewidth=2) 202 | #plot(nthfile,I_m[i],linemarks[i],label='I '+label[i],linewidth=2) 203 | 204 | #fill_between(nthfile, N_init_pop_m[0], N_init_pop_m[4]) 205 | xlabel('Time',fontsize=18) 206 | ylabel('Residents (Patch Mean)',fontsize=18) 207 | title(plottitle,fontsize=21) 208 | axis([-0.01,gen,0,np.max(R_patch_m)]) 209 | legend(loc=0) 210 | savefig(dir+savename+'PatchMean_R.png',dpi=savedpi) 211 | 212 | 213 | figure() 214 | for i in xrange(len(R_m)): 215 | #plot(nthfile,R_patch_m[i],linemarks[i],label='R '+label[i],linewidth=2) 216 | plot(nthfile,S1_patch_m[i],linemarks[i],label=label[i],linewidth=2) 217 | #plot(nthfile,S2_m[i],linemarks[i],label='S2 '+label[i],linewidth=2) 218 | #plot(nthfile,I_m[i],linemarks[i],label='I '+label[i],linewidth=2) 219 | 220 | #fill_between(nthfile, N_init_pop_m[0], N_init_pop_m[4]) 221 | xlabel('Time',fontsize=18) 222 | ylabel('Strayers (Patch Mean)',fontsize=18) 223 | title(plottitle,fontsize=21) 224 | axis([-0.01,gen,0,np.max(S1_patch_m)]) 225 | legend(loc=0) 226 | savefig(dir+savename+'PatchMean_S1.png',dpi=savedpi) 227 | 228 | figure() 229 | for i in xrange(len(R_m)): 230 | #plot(nthfile,R_patch_m[i],linemarks[i],label='R '+label[i],linewidth=2) 231 | #plot(nthfile,S1_m[i],linemarks[i],label='S1 '+label[i],linewidth=2) 232 | plot(nthfile,S2_patch_m[i],linemarks[i],label=label[i],linewidth=2) 233 | #plot(nthfile,I_m[i],linemarks[i],label='I '+label[i],linewidth=2) 234 | 235 | #fill_between(nthfile, N_init_pop_m[0], N_init_pop_m[4]) 236 | xlabel('Time',fontsize=18) 237 | ylabel('Forced Strayers (Patch Mean)',fontsize=18) 238 | title(plottitle,fontsize=21) 239 | axis([-0.01,gen,0,np.max(S2_patch_m)]) 240 | legend(loc=0) 241 | savefig(dir+savename+'PatchMean_S2.png',dpi=savedpi) 242 | 243 | figure() 244 | for i in xrange(len(R_m)): 245 | #plot(nthfile,R_patch_m[i],linemarks[i],label='R '+label[i],linewidth=2) 246 | #plot(nthfile,S1_m[i],linemarks[i],label='S1 '+label[i],linewidth=2) 247 | #plot(nthfile,S2_m[i],linemarks[i],label='S2 '+label[i],linewidth=2) 248 | plot(nthfile,I_patch_m[i],linemarks[i],label=label[i],linewidth=2) 249 | 250 | #fill_between(nthfile, N_init_pop_m[0], N_init_pop_m[4]) 251 | xlabel('Time',fontsize=18) 252 | ylabel('Immigrants (Patch Mean)',fontsize=18) 253 | title(plottitle,fontsize=21) 254 | axis([-0.01,gen,0,np.max(I_patch_m)]) 255 | legend(loc=0) 256 | savefig(dir+savename+'PatchMean_I.png',dpi=savedpi) 257 | 258 | figure() 259 | for i in xrange(len(R_m)): 260 | plot(nthfile,N_patch_m[i],linemarks[i],label=label[i],linewidth=2) 261 | #plot(nthfile,S1_m[i],linemarks[i],label='S1 '+label[i],linewidth=2) 262 | #plot(nthfile,S2_m[i],linemarks[i],label='S2 '+label[i],linewidth=2) 263 | #plot(nthfile,I_m[i],linemarks[i],label='I '+label[i],linewidth=2) 264 | 265 | #fill_between(nthfile, N_init_pop_m[0], N_init_pop_m[4]) 266 | xlabel('Time',fontsize=18) 267 | ylabel('Total N (Patch Mean)',fontsize=18) 268 | title(plottitle,fontsize=21) 269 | axis([-0.01,gen,0,np.max(N_patch_m)]) 270 | legend(loc=0) 271 | savefig(dir+savename+'PatchMean_N.png',dpi=savedpi) 272 | 273 | show() 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /src/post_analysis_scripts/plotSizeAgeGenes_v0.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------- 2 | # plotSizeAge.py 3 | # Erin Landguth 4 | # July 27, 2015 5 | # Description: This script reads in size/age information 6 | # for given year and plots. 7 | # v0 - Initial script 8 | # --------------------------------------------------- 9 | 10 | # Import statements 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,os,copy 17 | from random import * 18 | from pylab import * 19 | 20 | # Functions needed 21 | def count_unique(keys): 22 | uniq_keys = np.unique(keys) 23 | bins = uniq_keys.searchsorted(keys) 24 | return uniq_keys, np.bincount(bins) 25 | 26 | #----------------- 27 | # User Input 28 | #----------------- 29 | # Directory location of output.csv 30 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/data_WCT1384_2016Sampling/WCT2016Nov22_noGenes2x2/" 31 | # Outputname 32 | outname = "_Diagnostics_WCT2016Nov22_noGenes2x2_Back_" 33 | outdir = "D:/projects/CDmetaPOP/Seattle/Runs/data_WCT1384_2016Sampling/WCT2016Nov22_noGenes2x2/summary/" 34 | 35 | # batch number - batchrun(batchno)mcrun{mcrun} 36 | batchno = 0 37 | 38 | # Number of monte carlo runs - used to average 39 | mcruns = 2 40 | 41 | # Generation to extract summary from 42 | #gen = range(0,130,5) 43 | gen = [100] 44 | #gen = [0,13,99] 45 | # Number of patches 46 | n = 1384 47 | 48 | # Which grid files to do ind{}.csv or indSample{}.csv (ind or indSample) 49 | gridformat = 'ind' 50 | 51 | # Calculate each statistic - Error (use qnorm(0.975)=1.959964 - couldn't find equivalent qnorm) 52 | qnorm = 1.959964 53 | 54 | # ------------------ 55 | # End User Input 56 | # ------------------ 57 | 58 | # List folders in this dir 59 | def listdirs(folder): 60 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 61 | folderList = listdirs(dir) 62 | 63 | # -------------------- 64 | # Begin gen loop 65 | # -------------------- 66 | size_2 = [] 67 | age_2 = [] 68 | size_1 = [] 69 | age_1 = [] 70 | size_0 = [] 71 | age_0 = [] 72 | L0_2 = [] 73 | L0_1 = [] 74 | L0_0 = [] 75 | for igen in xrange(len(gen)): 76 | 77 | # ---------------------------- 78 | # Preliminary vector storage 79 | # ---------------------------- 80 | # All information 81 | size_2.append([]) 82 | age_2.append([]) 83 | size_1.append([]) 84 | age_1.append([]) 85 | size_0.append([]) 86 | age_0.append([]) 87 | L0_2.append([]) 88 | L0_1.append([]) 89 | L0_0.append([]) 90 | 91 | # ----------------------------------- 92 | # Read in and store metrics 93 | # ----------------------------------- 94 | # Loop over folders 95 | for imc in xrange(mcruns): 96 | 97 | # Add a batch spot to the vectors 98 | size_2[igen].append([]) 99 | age_2[igen].append([]) 100 | size_1[igen].append([]) 101 | age_1[igen].append([]) 102 | size_0[igen].append([]) 103 | age_0[igen].append([]) 104 | L0_2[igen].append([]) 105 | L0_1[igen].append([]) 106 | L0_0[igen].append([]) 107 | 108 | # -------------------------- 109 | # Read in information 110 | # -------------------------- 111 | # Open file to extract number of migrants 112 | xyinputfile = open(dir+"batchrun"+str(batchno)+"mcrun"+str(imc)+"/"+gridformat+str(gen[igen])+".csv",'r') 113 | 114 | # Read lines from the file 115 | lines = xyinputfile.readlines() 116 | 117 | #Close the file 118 | xyinputfile.close() 119 | 120 | # Create an empty matrix to append to 121 | x = [] 122 | 123 | # Split up each line in file and append to empty matrix for generation specified 124 | for i in xrange(len(lines)): 125 | thisline = lines[i].split(',') 126 | x.append(thisline) 127 | L0 = [] 128 | age = [] 129 | size = [] 130 | # Extract values from this grid 131 | for i in xrange(len(x)-1): 132 | size.append(float(x[i+1][6])) 133 | age.append(int(x[i+1][5])) 134 | L0.append(int(x[i+1][14])) 135 | L0 = np.asarray(L0) 136 | age = np.asarray(age) 137 | size = np.asarray(size) 138 | age_0[igen][imc].append(age[np.where(L0 == 0)[0]]) 139 | age_1[igen][imc].append(age[np.where(L0 == 1)[0]]) 140 | age_2[igen][imc].append(age[np.where(L0 == 2)[0]]) 141 | size_0[igen][imc].append(size[np.where(L0 == 0)[0]]) 142 | size_1[igen][imc].append(size[np.where(L0 == 1)[0]]) 143 | size_2[igen][imc].append(size[np.where(L0 == 2)[0]]) 144 | 145 | # -------------------------------- 146 | # Summary MC 147 | # -------------------------------- 148 | ''' 149 | age_0 = np.nansum(age_0,axis = 1)/mcruns 150 | age_1 = np.nansum(L0_1,axis = 1)/mcruns 151 | age_2 = np.nansum(L0_2,axis = 1)/mcruns 152 | 153 | age_0 = np.nansum(L0_0,axis = 1)/mcruns 154 | age_1 = np.nansum(L0_1,axis = 1)/mcruns 155 | age_2 = np.nansum(L0_2,axis = 1)/mcruns 156 | 157 | 158 | # ------------------------- 159 | # Write to file 160 | # ------------------------- 161 | for igen in xrange(len(gen)): 162 | outputfile_1 = open(dir+'L0summary_Time'+str(gen[igen])+'_'+outname+'.csv','w') 163 | outputfile_2 = open(dir+'L0summary_Time'+str(gen[igen])+'_'+outname+'_forARC.csv','w') 164 | 165 | # Write title 166 | outputfile_1.write('Patch,X,Y,K,N,L0_2,L0_1,L0_0\n') 167 | outputfile_2.write('Patch,X,Y,K,N,L0_2,L0_1,L0_0\n') 168 | 169 | # Write each info 170 | for i in range(len(K)): 171 | outputfile_1.write(str(Patch[i])+',') 172 | outputfile_1.write(str(X[i])+',') 173 | outputfile_1.write(str(Y[i])+',') 174 | outputfile_1.write(str(K[i])+',') 175 | outputfile_1.write(str(N_m[igen][i])+',') 176 | outputfile_1.write(str(L0_2[igen][i])+',') 177 | outputfile_1.write(str(L0_1[igen][i])+',') 178 | outputfile_1.write(str(L0_0[igen][i])+'\n') 179 | 180 | outputfile_2.write(str(Patch[i])+',') 181 | outputfile_2.write(str(X[i])+',') 182 | outputfile_2.write(str(Y[i])+',') 183 | outputfile_2.write(str(K[i])+',') 184 | if N_m[igen][i] <= 1: 185 | outputfile_2.write('-9999,-9999,-9999,-9999\n') 186 | else: 187 | outputfile_2.write(str(N_m[igen][i])+',') 188 | outputfile_2.write(str(L0_2[igen][i])+',') 189 | outputfile_2.write(str(L0_1[igen][i])+',') 190 | outputfile_2.write(str(L0_0[igen][i])+'\n') 191 | 192 | outputfile_1.close() 193 | outputfile_2.close() 194 | ''' 195 | 196 | # ---------------------------- 197 | # poly fits 198 | # ---------------------------- 199 | z_2 = np.polyfit(age_2[0][0][0],size_2[0][0][0],2) 200 | p_2 = np.poly1d(z_2) 201 | z_1 = np.polyfit(age_1[0][0][0],size_1[0][0][0],2) 202 | p_1 = np.poly1d(z_1) 203 | z_0 = np.polyfit(age_0[0][0][0],size_0[0][0][0],2) 204 | p_0 = np.poly1d(z_0) 205 | xp = np.linspace(0,14,100) 206 | 207 | z_all = np.polyfit(age,size,2) 208 | p_all = np.poly1d(z_all) 209 | 210 | # -------------------------------------------------- 211 | # Plotting size v age 212 | # -------------------------------------------------- 213 | fontsize=18 214 | savedpi = 1000 215 | figure() 216 | plot(age_2[0][0][0],size_2[0][0][0],'.y') 217 | plot(xp,p_2(xp),'-y',label='AABB') 218 | xlabel('Age',fontsize=22) 219 | ylabel('Size',fontsize=22) 220 | axis([-0.1,10,-0.1,250]) 221 | legend(loc=0,prop={'size':14}) 222 | # Updating fontsize on axes 223 | ax = gca() 224 | for tick in ax.xaxis.get_major_ticks(): 225 | tick.label1.set_fontsize(fontsize) 226 | for tick in ax.yaxis.get_major_ticks(): 227 | tick.label1.set_fontsize(fontsize) 228 | savefig(dir+outname+'_AgeSize_L0_2.png',dpi=savedpi,bbox_inches='tight') 229 | 230 | figure() 231 | plot(age_1[igen][0][0],size_1[0][0][0],'.g') 232 | plot(xp,p_1(xp),'-g',label='AaBb') 233 | xlabel('Age',fontsize=22) 234 | ylabel('Size',fontsize=22) 235 | axis([-0.1,10,-0.1,250]) 236 | legend(loc=0,prop={'size':14}) 237 | # Updating fontsize on axes 238 | ax = gca() 239 | for tick in ax.xaxis.get_major_ticks(): 240 | tick.label1.set_fontsize(fontsize) 241 | for tick in ax.yaxis.get_major_ticks(): 242 | tick.label1.set_fontsize(fontsize) 243 | savefig(dir+outname+'_AgeSize_L0_1.png',dpi=savedpi,bbox_inches='tight') 244 | 245 | figure() 246 | plot(age_0[igen][0][0],size_0[0][0][0],'.r') 247 | plot(xp,p_0(xp),'-r',label='aabb') 248 | xlabel('Age',fontsize=20) 249 | ylabel('Size',fontsize=20) 250 | axis([-0.1,10,-0.1,250]) 251 | legend(loc=0,prop={'size':14}) 252 | # Updating fontsize on axes 253 | ax = gca() 254 | for tick in ax.xaxis.get_major_ticks(): 255 | tick.label1.set_fontsize(fontsize) 256 | for tick in ax.yaxis.get_major_ticks(): 257 | tick.label1.set_fontsize(fontsize) 258 | savefig(dir+outname+'_AgeSize_L0_0.png',dpi=savedpi,bbox_inches='tight') 259 | 260 | figure() 261 | plot(age,size,'.b') 262 | plot(xp,p_all(xp),'-b',label='') 263 | xlabel('Age',fontsize=20) 264 | ylabel('Size',fontsize=20) 265 | axis([-0.1,10,-0.1,250]) 266 | legend(loc=0,prop={'size':14}) 267 | # Updating fontsize on axes 268 | ax = gca() 269 | for tick in ax.xaxis.get_major_ticks(): 270 | tick.label1.set_fontsize(fontsize) 271 | for tick in ax.yaxis.get_major_ticks(): 272 | tick.label1.set_fontsize(fontsize) 273 | savefig(dir+outname+'_AgeSize_L0_0.png',dpi=savedpi,bbox_inches='tight') 274 | 275 | show() -------------------------------------------------------------------------------- /src/post_analysis_scripts/plotSizeAge_v0.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------- 2 | # plotSizeAge.py 3 | # Erin Landguth 4 | # July 27, 2015 5 | # Description: This script reads in size/age information 6 | # for given year and plots. 7 | # v0 - Initial script 8 | # --------------------------------------------------- 9 | 10 | # Import statements 11 | try: 12 | import numpy as np 13 | from numpy.random import * 14 | except ImportError: 15 | raise ImportError, "Numpy required." 16 | import pdb,os,copy 17 | from random import * 18 | from pylab import * 19 | 20 | # Functions needed 21 | def count_unique(keys): 22 | uniq_keys = np.unique(keys) 23 | bins = uniq_keys.searchsorted(keys) 24 | return uniq_keys, np.bincount(bins) 25 | 26 | #----------------- 27 | # User Input 28 | #----------------- 29 | # Directory location of output.csv 30 | dir = "D:/projects/CDmetaPOP/Seattle/Runs/data_WCT1384_2016Sampling/WCT2016Nov22_noGenes2x2/" 31 | # Outputname 32 | outname = "_Diagnostics_WCT2016Nov22_noGenes2x2_OUT_" 33 | outdir = "D:/projects/CDmetaPOP/Seattle/Runs/data_WCT1384_2016Sampling/WCT2016Nov22_noGenes2x2/summary/" 34 | 35 | # batch number - batchrun(batchno)mcrun{mcrun} 36 | batchno = 0 37 | 38 | # Number of monte carlo runs - used to average 39 | mcruns = 2 40 | 41 | # Generation to extract summary from 42 | #gen = range(0,130,5) 43 | gen = [100] 44 | #gen = [0,13,99] 45 | # Number of patches 46 | n = 1384 47 | 48 | # Which grid files to do ind{}.csv or indSample{}.csv (ind or indSample) 49 | gridformat = 'indSample' 50 | 51 | # Calculate each statistic - Error (use qnorm(0.975)=1.959964 - couldn't find equivalent qnorm) 52 | qnorm = 1.959964 53 | 54 | # ------------------ 55 | # End User Input 56 | # ------------------ 57 | 58 | # List folders in this dir 59 | def listdirs(folder): 60 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 61 | folderList = listdirs(dir) 62 | 63 | # -------------------- 64 | # Begin gen loop 65 | # -------------------- 66 | size_2 = [] 67 | age_2 = [] 68 | size_1 = [] 69 | age_1 = [] 70 | size_0 = [] 71 | age_0 = [] 72 | L0_2 = [] 73 | L0_1 = [] 74 | L0_0 = [] 75 | for igen in xrange(len(gen)): 76 | 77 | # ---------------------------- 78 | # Preliminary vector storage 79 | # ---------------------------- 80 | # All information 81 | size_2.append([]) 82 | age_2.append([]) 83 | size_1.append([]) 84 | age_1.append([]) 85 | size_0.append([]) 86 | age_0.append([]) 87 | L0_2.append([]) 88 | L0_1.append([]) 89 | L0_0.append([]) 90 | 91 | # ----------------------------------- 92 | # Read in and store metrics 93 | # ----------------------------------- 94 | # Loop over folders 95 | for imc in xrange(mcruns): 96 | 97 | # Add a batch spot to the vectors 98 | size_2[igen].append([]) 99 | age_2[igen].append([]) 100 | size_1[igen].append([]) 101 | age_1[igen].append([]) 102 | size_0[igen].append([]) 103 | age_0[igen].append([]) 104 | L0_2[igen].append([]) 105 | L0_1[igen].append([]) 106 | L0_0[igen].append([]) 107 | 108 | # -------------------------- 109 | # Read in information 110 | # -------------------------- 111 | # Open file to extract number of migrants 112 | xyinputfile = open(dir+"batchrun"+str(batchno)+"mcrun"+str(imc)+"/"+gridformat+str(gen[igen])+".csv",'r') 113 | 114 | # Read lines from the file 115 | lines = xyinputfile.readlines() 116 | 117 | #Close the file 118 | xyinputfile.close() 119 | 120 | # Create an empty matrix to append to 121 | x = [] 122 | 123 | # Split up each line in file and append to empty matrix for generation specified 124 | for i in xrange(len(lines)): 125 | thisline = lines[i].split(',') 126 | x.append(thisline) 127 | age = [] 128 | size = [] 129 | # Extract values from this grid 130 | for i in xrange(len(x)-1): 131 | size.append(float(x[i+1][6])) 132 | age.append(int(x[i+1][5])) 133 | 134 | age = np.asarray(age) 135 | size = np.asarray(size) 136 | 137 | # -------------------------------- 138 | # Summary MC 139 | # -------------------------------- 140 | 141 | 142 | # ------------------------- 143 | # Write to file 144 | # ------------------------- 145 | 146 | # ---------------------------- 147 | # poly fits 148 | # ---------------------------- 149 | xp = np.linspace(0,14,100) 150 | z_all = np.polyfit(age,size,2) 151 | p_all = np.poly1d(z_all) 152 | 153 | # -------------------------------------------------- 154 | # Plotting size v age 155 | # -------------------------------------------------- 156 | fontsize=18 157 | savedpi = 1000 158 | 159 | figure() 160 | plot(age,size,'.b') 161 | plot(xp,p_all(xp),'-b',label='') 162 | xlabel('Age',fontsize=20) 163 | ylabel('Size',fontsize=20) 164 | axis([-0.1,10,-0.1,250]) 165 | legend(loc=0,prop={'size':14}) 166 | # Updating fontsize on axes 167 | ax = gca() 168 | for tick in ax.xaxis.get_major_ticks(): 169 | tick.label1.set_fontsize(fontsize) 170 | for tick in ax.yaxis.get_major_ticks(): 171 | tick.label1.set_fontsize(fontsize) 172 | savefig(outdir+outname+'_AgeSize.png',dpi=savedpi,bbox_inches='tight') 173 | 174 | show() -------------------------------------------------------------------------------- /src/post_analysis_scripts/splitpatch_v100.py: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # splitpatch.py 3 | # 2015 05 25: Erin Landguth 4 | # This script grabs summary.csv files, splits bars for given parameter, writes 5 | # seperate file. 6 | # v0.99 - Initial script for version 0.99 files. 7 | # ----------------------------------------------------------------------------- 8 | 9 | # Load modules 10 | import os,pdb,pandas 11 | from pylab import * 12 | import scipy as sp 13 | 14 | # Numpy functions 15 | try: 16 | import numpy as np 17 | from numpy.random import * 18 | except ImportError: 19 | raise ImportError, "Numpy required." 20 | 21 | # --------- 22 | # User info 23 | # --------- 24 | dir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_MovementDistances/' 25 | savename = "WCT_100Max_NInit_" 26 | # batch number - batchrun(batchno)mcrun{mcrun} 27 | batchno = 2 28 | 29 | dir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_StrayRates/' 30 | savename = "NInit_WCT_50max_str0.001_" 31 | savename = "NInit_WCT_50max_str0.01_" 32 | savename = "NInit_WCT_50max_str0.05_" 33 | batchno = 2 34 | 35 | dir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/All_Landscapes/' 36 | savename = "NInit_WCT_50max_str0.05_Riverine_" 37 | #savename = "NInit_WCT_50max_str0.05_ExBarr" 38 | #savename = "NInit_WCT_50max_str0.05_FutBarr" 39 | #savename = "NInit_WCT_50max_str0.05_ChangeBarr" 40 | # batch number - batchrun(batchno)mcrun{mcrun} 41 | batchno = 0 42 | 43 | # Direction location of patchvars.csv to get X,Y values 44 | xydir = 'D:/projects/CDmetaPOP/Seattle/Runs/dataWCT1384_v1.00_20151130/PatchVars_WCT1384.csv' 45 | 46 | savedpi = 300 47 | qnorm = 1.959964 # For CIs, not in function 48 | gen = 125 # Number of years 49 | nthfile = range(0,gen,1) 50 | mcno = 2 # Number of MCs 51 | 52 | # List folders in this directory 53 | def listdirs(folder): 54 | return [d for d in (os.path.join(folder, d1) for d1 in os.listdir(folder)) if os.path.isdir(d)] 55 | folderList = listdirs(dir) 56 | 57 | # --------------------------------- 58 | # Read in XY file and store XY 59 | # --------------------------------- 60 | Patch = [] 61 | X = [] 62 | Y = [] 63 | # Open output.csv file in folder 64 | inputfile = open(xydir) 65 | 66 | # Read lines from the file 67 | lines = inputfile.readlines() 68 | 69 | #Close the file 70 | inputfile.close() 71 | 72 | # Create an empty matrix to append to 73 | values = [] 74 | 75 | # Split up each line in file and append to empty matrix for generation specified 76 | for i in xrange(len(lines)): 77 | thisline = lines[i].split(',') 78 | values.append(thisline) 79 | # Delete lines 80 | del(lines) 81 | 82 | # Grab values from file 83 | for i in xrange(len(values)-1): 84 | Patch.append(int(values[1+i][0])) 85 | X.append(float(values[1+i][1])) 86 | Y.append(float(values[1+i][2])) 87 | 88 | # --------------------------------- 89 | # Read in summary file information 90 | # --------------------------------- 91 | 92 | N_Init = [] 93 | R = [] 94 | S = [] 95 | I = [] 96 | He = [] 97 | 98 | # Loop through MCs 99 | for imc in xrange(mcno): 100 | 101 | N_Init.append([]) 102 | R.append([]) 103 | S.append([]) 104 | I.append([]) 105 | 106 | # Open output.csv file in folder 107 | inputfile = open(dir+'batchrun'+str(batchno)+'mcrun'+str(imc)+'/summary_popAllTime.csv') 108 | 109 | # Read lines from the file 110 | lines = inputfile.readlines() 111 | 112 | #Close the file 113 | inputfile.close() 114 | 115 | # Create an empty matrix to append to 116 | values = [] 117 | 118 | # Split up each line in file and append to empty matrix for generation specified 119 | for i in xrange(len(lines)): 120 | thisline = lines[i].split(',') 121 | values.append(thisline) 122 | 123 | # Delete lines 124 | del(lines) 125 | 126 | # Then Loop through generations/time 127 | for iout in xrange(gen): 128 | 129 | N_Init[imc].append([]) 130 | R[imc].append([]) 131 | S[imc].append([]) 132 | I[imc].append([]) 133 | 134 | 135 | # Grab all patch values - patch values with total 136 | for j in xrange(1,len(values[1+iout][3].split('|'))-1): 137 | N_Init[imc][iout].append(int(values[1+iout][3].split('|')[j])) 138 | #R[imc][iout].append(int(values[1+iout][57].split('|')[j])) 139 | #S[imc][iout].append(int(values[1+iout][58].split('|')[j])) 140 | #I[imc][iout].append(int(values[1+iout][60].split('|')[j])) 141 | 142 | N_Init = np.asarray(N_Init) 143 | #R = np.asarray(R) 144 | #S = np.asarray(S) 145 | #I = np.asarray(I) 146 | 147 | # -------------------------------------------- 148 | # Get mean over Monte Carlos 149 | # -------------------------------------------- 150 | N_Init_m = np.nansum(N_Init,axis=0)/mcno 151 | N_Init_sd = np.std(N_Init,axis=0) 152 | error = qnorm*N_Init_sd/(mcno) 153 | N_Init_l = N_Init_m-error 154 | N_Init_r = N_Init_m+error 155 | N_Init_min = np.min(N_Init,axis=0) 156 | N_Init_max = np.max(N_Init,axis=0) 157 | ''' 158 | R_m = np.nansum(R,axis=0)/mcno 159 | R_sd = np.std(R,axis=0) 160 | error = qnorm*R_sd/(mcno) 161 | R_l = R_m-error 162 | R_r = R_m+error 163 | R_min = np.min(R,axis=0) 164 | R_max = np.max(R,axis=0) 165 | 166 | S_m = np.nansum(S,axis=0)/mcno 167 | S_sd = np.std(S,axis=0) 168 | error = qnorm*S_sd/(mcno) 169 | S_l = S_m-error 170 | S_r = S_m+error 171 | S_min = np.min(S,axis=0) 172 | S_max = np.max(S,axis=0) 173 | 174 | I_m = np.nansum(I,axis=0)/mcno 175 | I_sd = np.std(I,axis=0) 176 | error = qnorm*I_sd/(mcno) 177 | I_l = I_m-error 178 | I_r = I_m+error 179 | I_min = np.min(I,axis=0) 180 | I_max = np.max(I,axis=0) 181 | ''' 182 | # ----------------------------- 183 | # Write to file 1 184 | # ----------------------------- 185 | # And write out title at end of file 186 | outputfile = open(dir+savename+'1.csv','w') 187 | 188 | # Create year string 189 | timeloop = range(2000,2000+gen,1) 190 | 191 | # Write out title 192 | outputfile.write('Patch,X,Y,') 193 | for iout in xrange(gen-1): 194 | outputfile.write('T'+str(timeloop[iout])+',') 195 | outputfile.write('T'+str(timeloop[iout+1])+'\n') 196 | 197 | # Write out values 198 | for ipatch in xrange(len(N_Init_m[0])): 199 | outputfile.write(str(Patch[ipatch])+','+str(X[ipatch])+','+str(Y[ipatch])+',') 200 | for itime in xrange(len(N_Init_m)-1): 201 | outputfile.write(str(N_Init_m[itime][ipatch])+',') 202 | outputfile.write(str(N_Init_m[itime+1][ipatch])+'\n') 203 | 204 | #Close the file 205 | outputfile.close() 206 | 207 | # ----------------------------- 208 | # Write to file 2 209 | # ----------------------------- 210 | 211 | # And write out title at end of file 212 | outputfile = open(dir+savename+'2.csv','w') 213 | 214 | # Create year string 215 | timeloop = range(1995,1995+gen,1) 216 | 217 | # Write out title 218 | outputfile.write('Patch,X,Y,Value,Time\n') 219 | for itime in xrange(len(timeloop)): 220 | timeout = '1/1/'+str(timeloop[itime]) 221 | for ipatch in xrange(len(N_Init_m[0])): 222 | outputfile.write(str(Patch[ipatch])+','+str(X[ipatch])+','+str(Y[ipatch])+','+str(N_Init_m[itime][ipatch])+','+timeout+'\n') 223 | 224 | #Close the file 225 | outputfile.close() 226 | 227 | 228 | --------------------------------------------------------------------------------