RangeShifter / RangeShiftR-package

⚠️ Archive ⚠️ of the old structure of the R package as interface to the RangeShifter simulation platform. Please use the new structure: https://github.com/RangeShifter/RangeShiftR-pkg
https://rangeshifter.github.io/RangeshiftR-tutorials/
GNU General Public License v3.0
16 stars 5 forks source link

How incorporate genetics to track neutral divresity and neutral population structure along changes in landscape #7

Closed tapirus07 closed 10 months ago

tapirus07 commented 10 months ago

I am performing a PHVA analysis for a plant distributed in patches. Some of these patches will be mined, so they will disappear or be partially destroyed. I want to incorporate genetic information in the simulation. I am not interested in any trait, inheritage, evolution of traits. I just want to figure out if past and future changes in landscape yielded or will produce changes in genetic diversity or genetic spatial structure. Below you can find my reasoning/code. I would appreciate any advice about how to incorporate genetics in my problem.

Two problems/challenges: (1) Population size is huge, starts with ~4 millions (first scenario) and ends with ~100 thousand individuals. (2) When I do not set IndVar=T, my genetic output is empty, but when I set IndVar=T, it looks like I cannot have StageDependent Emigration. So I am confused, because it does not make sense to assume seedlings or adult plants can disperse. Just seeds can do.

So, I set an age structured population (4 stages from seed to adult) in a sexual model.

agestr=StageStructure(Stages = nrow(trans), #NUMBER OF STAGES TransMatrix =trans, #LESLIE TRANSITION MATRIX FecDensDep =T, #DENSITY-DEPENDENT FECUNDITY MinAge=0, RepSeasons=1) demo=Demography(StageStruct = agestr, ReproductionType=1)

Landscape changes through time (5 sequential scenarios: 4 known past scenarios and one projected new disturbation). I want to simulate 100 years in each landscape scenario.

land <- ImportedLandscape( LandscapeFile = c("habitatEden_new.asc","habitatCurrent_new.asc","habitatPASV_new.asc","habitatLO_new.asc","habitatN3_new.asc"), PatchFile = c("mpatchALL_new.asc","mpatchALL_current_new.asc","mpatchALL_pasv_new.asc","mpatchALL_lo_new.asc","mpatchALL_n3_new.asc"), Resolution = 50, Nhabitats = 13, DynamicLandYears = c(0,100,200,300,400), K_or_DensDep=k, #K if not structured, d^-1 if structured

USE getLocalisedEquilPop~conceptualized K per patch

                      SpDistFile = "occuALL_new.asc",
                      SpDistResolution=50)

I also set emigration as stage dependent (just seeds can emigrate), and kernel distance as minimum (50m, landscape pixel size) once seeds are barochoric. Dispersed seeds just die if they fall in an unsuitable habitat.

em=Emigration(StageDep=T, EmigProb = matrix(c(0:3,0.30,0,0,0),4,2)) dkern=DispersalKernel(Distances = 50) set=Settlement(SexDep=F,Settle=0) disp=Dispersal(Emigration=em, Transfer=dkern,Settlement=set)

I initialise with every patch occupied in a field observed proportion of stages (propstr)

init <- Initialise(InitType=1, SpType=0,InitDens = 0, PropStages = propstr)

I also set the genetic module as simple as possible. Note, there is no trait involved. I just wanna simulate how changes in space could change genetic diversity or create genetic structure

gene=Genetics(Architecture=0, NLoci=1,ProbMutn=0.001,MutationSD=1,ProbCross=0.3, AlleleSD=0.1)

Then, I run the simulation, but the genetic output file are always empty (e.g.; Batch1_Sim1_Land1_Rep0_Genetics.txt)

s <- RSsim() sim <- Simulation(Simulation=1, Years=500, Replicates=2, OutIntPop=1, OutIntRange=1, OutIntOcc=1, OutIntGenetic=1, OutGenType=2, OutGenCrossTab=T, EnvStoch=1, #ENVIROMENTAL STOCHASTICITY EnvStochType=0, #FECUNDITY FOR AGESTRUCTURED std=1, #0.96-1.23 #?????? PROPORTION OF INCREASE ac=0, maxR=trans[1,4]+trans[1,4]*0, minR=0.1 )

dynamic=RSsim(simul=sim,land=land,demog=demo,dispersal=disp,gene=gene, init=init,seed=1,batchnum=1) RunRS(dynamic, dirpath)

JetteReeg commented 10 months ago

Hi,

this is not a technical issue of the RangeShiftR package but a question regarding the application of RangeShiftR and the parameter settings. We have a discussion forum to ask these kind of questions.

Please always check the existing documentation of RangeShifter before posting a question (manual, tutorial and R help files).

In your case, the R help file ?Emigration actually gives you the answer: You need to set the parameter EmigStage to define which stage emigrates. This is also explained in the manual (p. 64f).

Best, Jette