Skip to content

Commit

Permalink
update tskit schema for individual metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Aug 16, 2023
1 parent a928e37 commit 162711b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions fwdpy11/_types/diploid_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def liftover(input, output):
output['nodes'][i] = input[i].nodes
output['geography'][i] = input[i].geography
output['label'][i] = input[i].label
output['id'][i] = input[i].id
decoded_md = fwdpy11.tskit_tools.decode_individual_metadata(ts)
# Take a writeable VIEW of the C++-side data...
md = np.array(ll._diploid_metadata, copy=False)
Expand Down
3 changes: 3 additions & 0 deletions fwdpy11/tskit_tools/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class DiploidMetadata(object):
:type deme: int
:param label: Index in the population at time of living/sampling
:type label: int
:param id: Unique identifier for this individual
:type id: int
:param alive: Individual is alive
:type alive: bool
:param preserved: Individual is preserved
Expand All @@ -70,6 +72,7 @@ class DiploidMetadata(object):
sex: int
deme: int
label: int
id: int
alive: bool = attr.ib(converter=bool)
preserved: bool = attr.ib(converter=bool)
first_generation: bool = attr.ib(converter=bool)
Expand Down
2 changes: 2 additions & 0 deletions fwdpy11/tskit_tools/metadata_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"sex": {"type": "number", "binaryFormat": "i"},
"deme": {"type": "number", "binaryFormat": "i"},
"label": {"type": "number", "binaryFormat": "Q"},
"id": {"type": "number", "binaryFormat": "L"},
"parents": {
"type": "array",
"items": {"type": "number", "binaryFormat": "Q"},
Expand Down Expand Up @@ -154,6 +155,7 @@ def generate_individual_metadata(
"sex": metadata.sex,
"deme": metadata.deme,
"label": metadata.label,
"id": metadata.id,
}
return d

Expand Down

0 comments on commit 162711b

Please sign in to comment.