Skip to content

Commit

Permalink
deprication of Blat and gff2psl
Browse files Browse the repository at this point in the history
  • Loading branch information
Acribbs committed Apr 4, 2024
1 parent c931a5d commit 77ab03c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
28 changes: 27 additions & 1 deletion cgat/Blat.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
'''Blat.py - tools for working with PSL formatted files and data
=============================================================
IMPORTANT NOTICE:
Several functions within this module are scheduled for
deprecation in May 2024.
Details regarding the specific functions to be deprecated
can be found in the documentation of each function.
This module provides a class to parse :term:`PSL` formatted
files such as those output by the BLAT tool.
This module defines the :class:`Blat.Match` class representing a
single entry and a series of iterators to iterate of :term:`PSL`
single entry and a series of iterators to iterate of :term:`SL`
formatted files (:func:`iterator`, :func:`iterator_target_overlap`,
...).
Expand All @@ -16,6 +23,8 @@
import copy
import string
import collections
import warnings
import functools

try:
import alignlib_lite
Expand All @@ -26,6 +35,19 @@
from cgatcore import experiment as E


def deprecated_class(cls):
orig_init = cls.__init__

@functools.wraps(orig_init)
def new_init(self, *args, **kwargs):
warnings.warn(f"{cls.__name__} is deprecated and will be removed in May 2024.", DeprecationWarning)
orig_init(self, *args, **kwargs)

cls.__init__ = new_init
return cls


@deprecated_class
class Error(Exception):
"""Base class for exceptions in this module."""

Expand All @@ -40,6 +62,7 @@ def _set_message(self, message):
message = property(_get_message, _set_message)


@deprecated_class
class ParsingError(Error):

"""Exception raised for errors while parsing
Expand All @@ -61,6 +84,7 @@ def __init__(self, message, line=None):
---------------------------------------------------------------------------------------------------------------------------------------------------------------"""


@deprecated_class
class Match:

"""a :term:`psl` formatted alignment.
Expand Down Expand Up @@ -479,6 +503,7 @@ def getHeaders(self):
"qStarts", "tStarts")


@deprecated_class
class MatchPSLX(Match):

def __init__(self):
Expand Down Expand Up @@ -601,6 +626,7 @@ def _iterate(infile):
yield match


@deprecated_class
class BlatIterator:

def __init__(self, f, *args, **kwargs):
Expand Down
7 changes: 7 additions & 0 deletions cgat/tools/gff2psl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:Tags: Genomics Intervals GFF PSL Conversion
Note: This script is scheduled for deprecation in May 2024.
Purpose
-------
Expand Down Expand Up @@ -46,12 +48,17 @@
import alignlib_lite
import cgat.Intervals as Intervals

def print_deprecation_warning():
warning_message = ("""WARNING: 'gff2psl.py' is deprecated and will be removed in May 2024.""")
print(warning_message, file=sys.stderr)


def main(argv=None):
"""script main.
parses command line options in sys.argv, unless *argv* is given.
"""
print_deprecation_warning()

if argv is None:
argv = sys.argv
Expand Down

0 comments on commit 77ab03c

Please sign in to comment.