Skip to content

Ancient samples that are directly ancestral to other samples #2260

Answered by petrelharp
apragsdale asked this question in Q&A
Discussion options

You must be logged in to vote

I think you could do this more simply with a union? Something like:

rng = np.random.default_rng()
pop_size = 3
demog = msprime.Demography.isolated_model([2])
L = 1
sample_time = 2

# history up until sample_time
ts1 = msprime.sim_ancestry(
    samples=[msprime.SampleSet(2)],
    demography=demog,
    end_time=sample_time,
    sequence_length=L,
    recombination_rate=0.1,
)
# history before that
ts2 = msprime.sim_ancestry(
    samples=[msprime.SampleSet(pop_size, time=sample_time)],
    demography=demog,
    sequence_length=L,
    recombination_rate=0.1,
)

roots = [n.id for n in ts1.nodes() if n.time == sample_time]
tips = ts2.samples()
rng.shuffle(tips)
node_mapping = [tskit.NULL for _ …

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@jeromekelleher
Comment options

Comment options

You must be logged in to vote
6 replies
@apragsdale
Comment options

@apragsdale
Comment options

@petrelharp
Comment options

@apragsdale
Comment options

@petrelharp
Comment options

Answer selected by apragsdale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants