Giter VIP home page Giter VIP logo

Comments (1)

petrelharp avatar petrelharp commented on September 14, 2024

This looks like expected behavior to me: in your slim script you have these bits:

// create admixing population
1 late() { 
     sim.treeSeqRememberIndividuals(sim.subpopulations.individuals);  
}
5 late() {
    sim.treeSeqOutput("3.slim2.trees");
}

The call to treeSeqRememberIndividuals ensures that those individuals from generation will be present in the output tree sequence, with their nodes marked as samples. (They are marked as "samples" because, along with the final generation, the output tree sequence has their entire genealogical history.)

This checks out: in the tree sequence the samples whose time is not 0.0 are all at 4.0 (in the past, so from generation 1):

>>> for n in ts.samples():
...    if ts.node(n).time > 0.0:
...       print(ts.node(n))
... 
{'id': 8, 'time': 4.0, 'population': 0, 'individual': 10, 'metadata': b'\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 9, 'time': 4.0, 'population': 0, 'individual': 10, 'metadata': b'\t\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 10, 'time': 4.0, 'population': 0, 'individual': 11, 'metadata': b'\n\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 11, 'time': 4.0, 'population': 0, 'individual': 11, 'metadata': b'\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 12, 'time': 4.0, 'population': 1, 'individual': 12, 'metadata': b'\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 13, 'time': 4.0, 'population': 1, 'individual': 12, 'metadata': b'\r\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 14, 'time': 4.0, 'population': 1, 'individual': 13, 'metadata': b'\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}
{'id': 15, 'time': 4.0, 'population': 1, 'individual': 13, 'metadata': b'\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'flags': 1}

Perhaps the documentation for treeSeqRememberIndividuals could be improved? The SLiM manual says

treeSeqRememberIndividuals() is for permanently adding particular individuals to the retained sample.

which doesn't seem bad but doesn't explicitly comment on this point. (I'm not sure if it should, though?) What do you think?

from pyslim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.