Suppose we run this script:
initialize() {
initializeTreeSeq();
initializeMutationRate(1e-3);
initializeMutationType("m1", 0.5, "f", 0.001);
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElement(g1, 0, 99999);
initializeRecombinationRate(1e-8);
}
1 early() {
sim.addSubpop("p1", 10);
}
early() {
cat("early: ");
catn(p1.individuals.phenotypeForTrait());
}
1:19 late() {
cat("late: ");
catn(p1.individuals.phenotypeForTrait());
}
20 early() {
cat("final: ");
catn(p1.individuals.phenotypeForTrait());
sim.treeSeqOutput("in.trees");
}
This writes out (in early()!) the tree sequence file with phenotypes recorded in metadata; we can verify this as follows:
# python -c "import tskit; print([ind.metadata['per_trait'] for ind in tskit.load('in.trees').individuals()])"
[[{'phenotype': 6.7861415138917165, 'offset': 1.0}], [{'phenotype': 6.67690035428362, 'offset': 1.0}], [{'phenotype': 6.59069003021617, 'offset': 1.0}], [{'phenotype': 6.602123797948265, 'offset': 1.0}], [{'phenotype': 6.725359768171507, 'offset': 1.0}], [{'phenotype': 6.691827682261045, 'offset': 1.0}], [{'phenotype': 7.033875325262007, 'offset': 1.0}], [{'phenotype': 7.005805053562283, 'offset': 1.0}], [{'phenotype': 6.67512438707715, 'offset': 1.0}], [{'phenotype': 6.51362239332308, 'offset': 1.0}]]
However, loading this back in with:
initialize() {
initializeTreeSeq();
initializeMutationRate(1e-3);
initializeMutationType("m1", 0.5, "f", 0.001);
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElement(g1, 0, 99999);
initializeRecombinationRate(1e-8);
}
1 early() {
sim.readFromPopulationFile("in.trees");
cat("read in: ");
catn(p1.individuals.phenotypeForTrait());
}
shows us that the individual's phenotypes are all NAN.
I think this is a bug?
Suppose we run this script:
This writes out (in
early()!) the tree sequence file with phenotypes recorded in metadata; we can verify this as follows:However, loading this back in with:
shows us that the individual's phenotypes are all NAN.
I think this is a bug?