Closed szhan closed 1 year ago
Rename the function to add_individual_to_tree_sequence
, because it is more appropriate.
I think it is handy to encapsulate a sample path and associated metadata in a class, like this.
@dataclass
class SamplePath:
"""
Class for storing the sample paths of an individual.
individual: Name of individual
samples: Sample path (just a list of sample ids)
site_positions: Site positions corresponding to the path
"""
individual: str
samples: np.ndarray
site_positions: np.ndarray
def length(self):
return(self.path.size)
At the moment, sample paths are added one at a time when calling
add_sample_to_tree_sequence
. The proper way of adding a new diploid individual to an existing tree sequence should be to add two sets of sample edges to the tree sequence and then to reference the new sample nodes to the individual.