Skip to content

Move C stats methods to stats.h #2817

Closed as not planned
Closed as not planned

Description

@jeromekelleher

The trees.c file is pretty big, and there's a lot of code involved in the general stats. Also, there will be stats we want to compute which use the variant decoding, which means we would need to start including genotypes.h in trees.h. This would be a bit circular, and mean that the library isn't really modular (from a C compile perspective) any more.

So, moving tsk_treeseq_diversity, (et al) tsk_treeseq_general_stat into the existing stats.c/h file seems like a good option (which can then include genotypes.h). The stats.c file just contains the LD calculator, which is seems we'll continue to want (some version of) for some time to come, as it has orthogonal performance advantages to #2805.

We should also probably include tsk_treeseq_genealogical_nearest_neighbours and tsk_treeseq_mean_descendants.

This would still leave the trees.c file plenty big.

The only downside I guess is that all of the tsk_treeseq "methods'' are no longer compiled together, but I don't think anyone will get too upset about that.

Any objections? @molpopgen, would this affect the rust packaging at all?

@lkirk - any thoughts? I guess we'd do this immediately after your #2805 drops?

Activity

  1. added
    C API
    Infrastructure and tools
    refactoring
    on Aug 14, 2023
  2. added this to the C API 1.1.2 milestone on Aug 14, 2023
  3. molpopgen commented on Aug 14, 2023

    @molpopgen
    Member

    It doesn't affect anything. The rust build works by compiling tskit-c and then grabbing the public API into a namespace. So as long as all things in header files remain visible, we're not affected by code organization changes.

  4. lkirk commented on Aug 25, 2023

    @lkirk
    Contributor

    @jeromekelleher I think that the reorganization sounds like a great idea. I agree with what you've proposed.

  5. modified the milestones: C API 1.1.4, on Apr 3, 2025
  6. moved this to Small things in Accessible Issueson Apr 30, 2025
  7. removed this from the milestone on Jun 12, 2025
  8. added
    future
    on Jun 12, 2025
  9. benjeffery commented on Jun 12, 2025

    @benjeffery
    Member

    Closing for inactivity and labelling "future", please re-open if you plan to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C APIInfrastructure and toolsfuturerefactoring

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions