function (float)Ne_Het(o sampley)
{
pi = calcHeterozygosity(sampley.genomes);
return pi / (4 * 1e-7);
}
where sampley is a object vector that I plan on defining as
sampley = sample (p1.individuals, asInteger(p1.individualCount/CONST);
where CONST is a constant that defines the proportion of the subset of the population.
I am planning on defining a custom column in a log file for this result:
1 early() {
sim.addSubpop("p1", 10);
log = community.createLogFile("TESTLOGCSV.csv");
log.addCycle();
log.addSubpopulationSize(p1);
log.addCustomColumn("sampley_ne", "Ne_Het(sampley);");
log.logRow();
}
My idea was to have this log csv to receive outputs later on by adding a log.logRow() in the ticks that I need. But I also want this csv to be started on tick 1 (as above).
It has not worked for me.
If I comment out log.logRow();, the simulation runs, but no log output (as expected).
When I leave it there, it says:
ERROR (EidosSymbolTable::_GetValue): undefined identifier sampley.
Then I tried to generate sampley with it:
1 early() {
sim.addSubpop("p1", 10);
sampley = sample(p1.individuals, asInteger(p1.individualCount/CONST));
log = community.createLogFile("TESTLOGCSV.csv");
log.addCycle();
log.addSubpopulationSize(p1);
log.addCustomColumn("sampley_ne", "Ne_Het(sampley);");
log.logRow();
which also doesn't work. I get the same undefined identifier (if I comment log.logRow(), it runs but the log is not created properly)
When I try to create sampley as a global constant (defineGlobal), SLiM/EIDOS tell me it can't because we are dealing with individuals.
Ideally, I would like to generate the "empty" log on 1 early() then log the rows at 1: late() of further ticks.
So what could be a solution here? I've tried with optional arguments for the function (using []) but also no good.
This works fine when I don't try to subset the population (use p1 as the argument for sampley in the function).
It is fine for sampley to be defined every generation or when I need it to be logged, but I am trying to generate a sampley object that will be the same for the log and for a vcf output (e.g. sampley.genomes.outputVCF() )
Thanks
JP
--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/803b5c54-83ba-4cf5-a595-ee13f4c0a334n%40googlegroups.com.
Hi Ben,Thanks for the reply.Indeed, the addSuppliedColumn() / setSuppliedValue() approach seems to fit what I am looking for. Thanks!However, and I believe this is expected, this approach doesn't seem to work with .setLogInterval() for automatic logging, right?Is there an alternative or it will be the case of creating a counter variable that will force the output once the counter reached the log interval I need?Thanks!JP
--
_______{: }---'-
João Pedro Fontenelle, PhD
OG-CO Postdoctoral Fellow in Genome Data Science
initialize() {
}
1 early() {
log = community.createLogFile("~/Desktop/log.txt", logInterval=10);
log.addTick();
log.addSuppliedColumn("foo");
defineConstant("LOG", log);
}
late() {
LOG.setSuppliedValue("foo", community.tick * 2);
}
2000 late() { }