Skip to content

Commit

Permalink
Other basic models passing in C
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromekelleher committed Jul 30, 2024
1 parent 85dc133 commit 0100ea7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/msprime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3025,6 +3025,7 @@ msp_dtwf_recombine(
ret = MSP_ERR_NO_MEMORY;
goto out;
}
z->lineage = x->lineage;
msp_set_segment_mass(self, z);
tsk_bug_assert(z->left < z->right);
if (x->next != NULL) {
Expand Down Expand Up @@ -3068,6 +3069,9 @@ msp_dtwf_recombine(

for (j = 0; j < MSP_MAX_PED_PLOIDY; j++) {
y = *rec_heads[j];
if (y == x_head) {
lineage_reset_segments(y->lineage);
}
if (y != x_head && y != NULL) {
lin = msp_alloc_lineage(self, y, label);
if (lin == NULL) {
Expand Down Expand Up @@ -4083,10 +4087,6 @@ msp_merge_ancestors(msp_t *self, avl_tree_t *Q, population_id_t population_id,
ret = MSP_ERR_NO_MEMORY;
goto out;
}
ret = msp_insert_individual(self, new_lineage);
if (ret != 0) {
goto out;
}
} else {
if ((self->additional_nodes & MSP_NODE_IS_CA_EVENT)
|| (!self->coalescing_segments_only && coalescence)) {
Expand All @@ -4099,10 +4099,21 @@ msp_merge_ancestors(msp_t *self, avl_tree_t *Q, population_id_t population_id,
z->next = alpha;
}
alpha->prev = z;
alpha->lineage = new_lineage;
msp_set_segment_mass(self, alpha);
z = alpha;
}
}
if (new_lineage != NULL) {
ret = msp_insert_individual(self, new_lineage);
if (ret != 0) {
goto out;
}
/* FIXME see note above about avoiding this by exausting
* the original chains */
lineage_reset_segments(new_lineage);
}

if (coalescence) {
if (!self->coalescing_segments_only) {
ret = msp_store_arg_edges(self, z, new_node_id);
Expand All @@ -4129,6 +4140,7 @@ msp_merge_ancestors(msp_t *self, avl_tree_t *Q, population_id_t population_id,
goto out;
}
}

if (ret_merged_head != NULL) {
*ret_merged_head = merged_head;
}
Expand Down

0 comments on commit 0100ea7

Please sign in to comment.