deprecating the SummaryInfo class in Bio.Align.AlignInfo (#5069)

This commit is contained in:
mdehoon
2025-09-21 18:06:00 +09:00
committed by GitHub
parent 0c4fae3d61
commit 593114d868
3 changed files with 27 additions and 4 deletions

View File

@ -12,8 +12,13 @@ be put into classes in this module.
""" """
import warnings
from Bio import BiopythonDeprecationWarning
class SummaryInfo: class SummaryInfo:
"""Calculate summary info about the alignment. """Calculate summary info about the alignment. (DEPRECATED)
This class should be used to calculate information summarizing the This class should be used to calculate information summarizing the
results of an alignment. This may either be straight consensus info results of an alignment. This may either be straight consensus info
@ -25,6 +30,22 @@ class SummaryInfo:
ic_vector attribute. A list of ic content for each column number. ic_vector attribute. A list of ic content for each column number.
""" """
warnings.warn(
"""\
The class SummaryInfo has been deprecated. Instead of
>>> align_info = AlignInfo.SummaryInfo(msa)
>>> sequence = align_info.get_column(1)
please use
>>> alignment = msa.alignment # to get a new-style Alignment object
>>> sequence = alignment[:, 1]
Here, `msa` is a MultipleSeqAlignment object and `alignment` is an
`Alignment` object.""",
BiopythonDeprecationWarning,
)
self.alignment = alignment self.alignment = alignment
self.ic_vector = [] self.ic_vector = []

View File

@ -114,8 +114,9 @@ wrapped is no longer available since SCOP moved to the EBI website.
Bio.AlignInfo Bio.AlignInfo
------------- -------------
The ``pos_specific_score_matrix`` method of the ``SummaryInfo`` class and the The ``pos_specific_score_matrix`` method of the ``SummaryInfo`` class and the
``PSSM`` class were deprecated in release 1.82, and removed in release 1.85. As ``PSSM`` class were deprecated in release 1.82, and removed in release 1.85.
an alternative, please use the ``alignment`` property of a ``MultipleSeqAlignment`` The ``SummaryInfo`` class itself was deprecated in release 1.86. As an
alternative, please use the ``alignment`` property of a ``MultipleSeqAlignment``
object to obtains a new-style ``Alignment`` object, and use it to create a object to obtains a new-style ``Alignment`` object, and use it to create a
``Bio.motifs.Motif`` object. For example, ``Bio.motifs.Motif`` object. For example,

View File

@ -394,7 +394,8 @@ T: 7.00 0.00 7.00 0.00 0.00 0.00 7.00 6.00 0.00 0.00 0.00
""", """,
) )
align_info = AlignInfo.SummaryInfo(msa) with self.assertWarns(BiopythonDeprecationWarning):
align_info = AlignInfo.SummaryInfo(msa)
self.assertEqual(align_info.get_column(1), "AAAAAAA") self.assertEqual(align_info.get_column(1), "AAAAAAA")
self.assertEqual(align_info.get_column(7), "TTTATTT") self.assertEqual(align_info.get_column(7), "TTTATTT")