Skip to content

Commit

Permalink
Remove WrappedTreeSequence (#978)
Browse files Browse the repository at this point in the history
* Remove deprecated tskit_tools.load function.
* Remove deprecated "wrapped" kwarg for dumping tree sequences

Closes #945
  • Loading branch information
molpopgen committed Oct 5, 2022
1 parent cbbc672 commit 7392b84
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 193 deletions.
16 changes: 4 additions & 12 deletions fwdpy11/_types/diploid_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import fwdpy11.tskit_tools._dump_tables_to_tskit
import numpy as np
import tskit
from fwdpy11.tskit_tools import WrappedTreeSequence

from .._fwdpy11 import DiploidGenotype, DiploidMetadata, ll_DiploidPopulation
from .model_params import ModelParams
Expand Down Expand Up @@ -208,7 +207,6 @@ def dump_tables_to_tskit(
seed: Optional[int] = None,
parameters: Optional[Dict] = None,
destructive=False,
wrapped=False,
) -> tskit.TreeSequence:
"""
Dump the population's TableCollection into
Expand Down Expand Up @@ -236,9 +234,6 @@ def dump_tables_to_tskit(
:param destructive: If `True`, delete data held by the current instance.
:type destructive: bool
:param wrapped: If `True`, return `fwdpy11.tskit_tools.WrappedTreeSequence`
:type wrapped: bool
:rtype: tskit.TreeSequence
For examples, see :ref:`tskitconvert_vignette`.
Expand Down Expand Up @@ -281,13 +276,11 @@ def dump_tables_to_tskit(
The `wrapped` keyword argument is deprecated.
.. versionadded:: 0.19.0
Removed deprecated `wrapped` keyword argument.
"""
if wrapped is True:
warnings.warn(
FutureWarning(
"the wrapped kwarg is deprecated and will be removed in a future release"
)
)
return fwdpy11.tskit_tools._dump_tables_to_tskit._dump_tables_to_tskit(
self,
model_params=model_params,
Expand All @@ -297,7 +290,6 @@ def dump_tables_to_tskit(
seed=seed,
parameters=parameters,
destructive=destructive,
wrapped=wrapped,
)

def dump_to_file(self, filename: str):
Expand Down
33 changes: 5 additions & 28 deletions fwdpy11/tskit_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
import tskit

from ._flags import * # NOQA
from .metadata import (DiploidMetadata, decode_individual_metadata,
decode_mutation_metadata)
from .trees import WrappedTreeSequence
from .metadata import (
DiploidMetadata,
decode_individual_metadata,
decode_mutation_metadata,
)


def get_toplevel_metadata(ts: tskit.TreeSequence, name: str) -> typing.Optional[object]:
Expand Down Expand Up @@ -106,28 +108,3 @@ def iterate_timepoints_with_individuals(
else:
decoded_individual_metadata = None
yield utime, node_table_rows, decoded_individual_metadata


def load(filename: str):
"""
Load a tree sequence from a file.
:param filename: Name of the trees file.
:type filename: str
:returns: A wrapped tree sequence
.. deprecated:: 0.17.0
Prefer {meth}`tskit.TreeSequence.load`
"""
import tskit

warnings.warn(
FutureWarning(
"fwdpy11.tskit_tools.load is deprecated. Please use tskit.load instead."
)
)

ts = tskit.load(filename)
return WrappedTreeSequence(ts=ts)
7 changes: 1 addition & 6 deletions fwdpy11/tskit_tools/_dump_tables_to_tskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import tskit
from fwdpy11._types.model_params import ModelParams

from .trees import WrappedTreeSequence


def _initializePopulationTable(
node_view, population_metadata: typing.Optional[typing.Dict[int, object]], tc
Expand Down Expand Up @@ -134,8 +132,7 @@ def _dump_tables_to_tskit(
seed: typing.Optional[int] = None,
parameters: typing.Optional[typing.Dict] = None,
destructive=False,
wrapped=False,
) -> typing.Union[tskit.TreeSequence, WrappedTreeSequence]:
) -> tskit.TreeSequence:
from .._fwdpy11 import gsl_version, pybind11_version

environment = tskit.provenance.get_environment(
Expand Down Expand Up @@ -239,8 +236,6 @@ def _dump_tables_to_tskit(

tc.provenances.add_row(json.dumps(provenance))

if wrapped is True:
return WrappedTreeSequence(ts=tc.tree_sequence())
return tc.tree_sequence()


Expand Down
147 changes: 0 additions & 147 deletions fwdpy11/tskit_tools/trees.py

This file was deleted.

0 comments on commit 7392b84

Please sign in to comment.