Skip to content

All methods that take a population as input should be able to handle population labels #2294

Closed as not planned

Description

@gtsambos

Over in the msprime tutorials, it sounds like we're encouraging users to name their populations instead of using the default numbers and labels. However, not all methods that take population as an argument have caught up with this practice.

For instance, the ts.samples() method (defined here) returns an empty array when you input anything other than the numerical IDs. This is confusing, in part because it's unexpected behaviour if you've been working with labels up to this point, and in part because it's indistinguishable the output you get when you use a valid population ID that happens to have no samples.

>>> ts.tables.populations[1]
PopulationTableRow(metadata={'description': '', 'name': 'BIG'})
>>> ts.samples(1)
array([20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
       37, 38, 39], dtype=int32)
>>> ts.samples('BIG')
array([], dtype=int32)

So basically what I'm saying is that the third command line here should return the same output as the second. I imagine this isn't a tricky fix -- I'm happy to be assigned, but won't be able to prioritise until after the workshops.

Activity

  1. added
    enhancement
    on May 24, 2022
  2. benjeffery commented on May 24, 2022

    @benjeffery
    Member

    Dupe of #1697

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions