[med-svn] [Git][med-team/python-gffutils][master] 14 commits: debhelper-compat 12

Michael R. Crusoe gitlab at salsa.debian.org
Tue Sep 24 15:59:40 BST 2019



Michael R. Crusoe pushed to branch master at Debian Med / python-gffutils


Commits:
5532da82 by Michael R. Crusoe at 2019-09-24T12:25:00Z
debhelper-compat 12

- - - - -
d8c858bd by Michael R. Crusoe at 2019-09-24T12:25:02Z
Standards-Version: 4.4.0

- - - - -
6098c170 by Michael R. Crusoe at 2019-09-24T12:25:03Z
Set upstream metadata fields: Name.
- - - - -
34bf40ad by Michael R. Crusoe at 2019-09-24T12:25:50Z
try running the tests

- - - - -
b150ab52 by Michael R. Crusoe at 2019-09-24T12:46:59Z
fix for Python 3.7

- - - - -
e73b36f4 by Michael R. Crusoe at 2019-09-24T13:00:06Z
doctests

- - - - -
1a79a1a1 by Michael R. Crusoe at 2019-09-24T13:01:56Z
support newer bedtools version

- - - - -
65f905e4 by Michael R. Crusoe at 2019-09-24T14:10:30Z
add autopkgtests & clean up after running the tests

- - - - -
19277bde by Michael R. Crusoe at 2019-09-24T14:12:00Z
lintian-overrides: allow a compressed test file

- - - - -
04d3b485 by Michael R. Crusoe at 2019-09-24T14:12:57Z
override: yes this is a science package

- - - - -
2e4606fb by Michael R. Crusoe at 2019-09-24T14:29:38Z
gffutils-cli: add unix manual page

- - - - -
19164660 by Michael R. Crusoe at 2019-09-24T14:30:00Z
Recommends: python3-pybedtools

- - - - -
4dbf3022 by Michael R. Crusoe at 2019-09-24T14:54:50Z
manpages fixup

- - - - -
7605e063 by Michael R. Crusoe at 2019-09-24T14:58:44Z
release 0.9-2

- - - - -


14 changed files:

- debian/changelog
- − debian/compat
- debian/control
- + debian/lintian-overrides
- + debian/manpages
- + debian/patches/flexible_tests
- + debian/patches/newer_bedtools
- + debian/patches/py37
- + debian/patches/python3
- + debian/patches/series
- debian/rules
- + debian/tests/control
- + debian/tests/run-tests
- debian/upstream/metadata


Changes:

=====================================
debian/changelog
=====================================
@@ -1,8 +1,15 @@
-python-gffutils (0.9-2) UNRELEASED; urgency=medium
+python-gffutils (0.9-2) unstable; urgency=medium
 
   * debhelper 11
-
- -- Michael R. Crusoe <michael.crusoe at gmail.com>  Thu, 14 Feb 2019 10:12:54 -0800
+  * debhelper-compat 12
+  * Standards-Version: 4.4.0
+  * Set upstream metadata fields: Name.
+  * Enable running the tests at build time; added autopkgtesting of upstream's
+    built-in tests
+  * Generate a unix manual page for gffutils-cli
+  * Recommend python3-pybedtools
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com>  Tue, 24 Sep 2019 16:58:24 +0200
 
 python-gffutils (0.9-1) unstable; urgency=medium
 


=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-11


=====================================
debian/control
=====================================
@@ -1,10 +1,10 @@
 Source: python-gffutils
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Michael R. Crusoe <michael.crusoe at gmail.com>,
- Steffen Moeller <moeller at debian.org>
+           Steffen Moeller <moeller at debian.org>
 Section: science
 Priority: optional
-Build-Depends: debhelper (>= 11~),
+Build-Depends: debhelper-compat (= 12),
                dh-python,
                bedtools,
                python3-all,
@@ -16,8 +16,9 @@ Build-Depends: debhelper (>= 11~),
                python3-pyfaidx,
                python3-nose,
                python3-biopython,
-               python3-pybedtools
-Standards-Version: 4.3.0
+               python3-pybedtools,
+               help2man
+Standards-Version: 4.4.0
 Vcs-Browser: https://salsa.debian.org/med-team/python-gffutils
 Vcs-Git: https://salsa.debian.org/med-team/python-gffutils.git
 Homepage: https://daler.github.io/gffutils
@@ -25,7 +26,9 @@ Homepage: https://daler.github.io/gffutils
 Package: python3-gffutils
 Architecture: all
 Depends: ${python3:Depends},
-         ${misc:Depends}
+         ${misc:Depends},
+         python3-biopython
+Recommends: python3-pybedtools
 Description: Work with GFF and GTF files in a flexible database framework
  A Python package for working with and manipulating the GFF and GTF format
  files typically used for genomic annotations.  Files are loaded into a


=====================================
debian/lintian-overrides
=====================================
@@ -0,0 +1,4 @@
+# needed for running the tests after installation
+duplicated-compressed-file usr/lib/python3/dist-packages/gffutils/test/data/gff_example1.gff3.gz
+# Yes, this is a science package
+wrong-section-according-to-package-name python3-gffutils => python


=====================================
debian/manpages
=====================================
@@ -0,0 +1 @@
+debian/*.1


=====================================
debian/patches/flexible_tests
=====================================
@@ -0,0 +1,20 @@
+From: Michael R. Crusoe <michael.crusoe at gmail.com>
+Subject: Ensure that tests work post-installation
+--- python-gffutils.orig/gffutils/test/test.py
++++ python-gffutils/gffutils/test/test.py
+@@ -621,6 +621,7 @@
+ 
+     # Serving test/data folder
+     served_folder = gffutils.example_filename('')
++    savedir = os.getcwd()
+     os.chdir(served_folder)
+ 
+     print("Starting SimpleHTTPServer in thread")
+@@ -654,6 +655,7 @@
+         print('Server shutdown.')
+         httpd.shutdown()
+         server_thread.join()
++        os.chdir(savedir)
+ 
+ 
+ def test_empty_files():


=====================================
debian/patches/newer_bedtools
=====================================
@@ -0,0 +1,168 @@
+From c602ddef45e5f4734b38ccaf36ad766ac2978273 Mon Sep 17 00:00:00 2001
+From: Ryan Dale <dalerr at niddk.nih.gov>
+Date: Mon, 30 Apr 2018 09:52:22 -0400
+Subject: Support newer bedtools version
+
+---
+--- python-gffutils.orig/gffutils/iterators.py
++++ python-gffutils/gffutils/iterators.py
+@@ -115,6 +115,7 @@
+     Subclass for iterating over features provided as a filename
+     """
+     def open_function(self, data):
++        data = os.path.expanduser(data)
+         if data.endswith('.gz'):
+             import gzip
+             return gzip.open(data)
+--- python-gffutils.orig/gffutils/test/test.py
++++ python-gffutils/gffutils/test/test.py
+@@ -880,7 +880,7 @@
+     assert len(filelist) == 1, filelist
+     assert filelist[0].endswith('.gffutils')
+ 
+-    #...and another one for gff. This time, make sure the suffix 
++    #...and another one for gff. This time, make sure the suffix
+     db = gffutils.create_db(
+         gffutils.example_filename('FBgn0031208.gff'), ':memory:', _keep_tempfiles=True)
+     filelist = os.listdir(tempdir)
+@@ -1006,7 +1006,7 @@
+ 
+ 
+ def test_deprecation_handler():
+-    return 
++    return
+ 
+     # TODO: when infer_gene_extent actually gets deprecated, test here.
+     assert_raises(ValueError, gffutils.create_db,
+@@ -1141,7 +1141,7 @@
+     assert f.attributes['null'][0] == '\x00'
+     assert f.attributes['comma'][0] == ','
+ 
+-    # Commas indicate 
++    # Commas indicate
+     assert f.attributes['Parent'] == ['A,', 'B%', 'C']
+     assert str(f) == s
+ 
+@@ -1174,6 +1174,18 @@
+     assert db['e']['Note'] == [',']
+     assert db['f']['Note'] == [',']
+ 
++
++def test_issue_105():
++    fn = gffutils.example_filename('FBgn0031208.gtf')
++    home = os.path.expanduser('~')
++    newfn = os.path.join(home, '.gffutils.test')
++    with open(newfn, 'w') as fout:
++        fout.write(open(fn).read())
++    f = gffutils.iterators.DataIterator(newfn)
++    for i in f:
++        pass
++    os.unlink(newfn)
++
+ if __name__ == "__main__":
+     # this test case fails
+     #test_attributes_modify()
+--- python-gffutils.orig/gffutils/pybedtools_integration.py
++++ python-gffutils/gffutils/pybedtools_integration.py
+@@ -2,11 +2,13 @@
+ Module for integration with pybedtools
+ """
+ 
++import os
+ import pybedtools
+ from pybedtools import featurefuncs
+ from gffutils import helpers
+ import six
+ 
++
+ def to_bedtool(iterator):
+     """
+     Convert any iterator into a pybedtools.BedTool object.
+@@ -22,7 +24,7 @@
+ 
+ 
+ def tsses(db, merge_overlapping=False, attrs=None, attrs_sep=":",
+-          merge_kwargs=dict(o='distinct', s=True, c=4), as_bed6=False):
++          merge_kwargs=None, as_bed6=False, bedtools_227_or_later=True):
+     """
+     Create 1-bp transcription start sites for all transcripts in the database
+     and return as a sorted pybedtools.BedTool object pointing to a temporary
+@@ -74,13 +76,21 @@
+         attributes is supplied, e.g. ["gene_id", "transcript_id"], then these
+         will be joined by `attr_join_sep` and then placed in the name field.
+ 
+-
+     attrs_sep: str
+         If `as_bed6=True` or `merge_overlapping=True`, then use this character
+         to separate attributes in the name field of the output BED. If also
+         using `merge_overlapping=True`, you'll probably want this to be
+         different than `merge_sep` in order to parse things out later.
+ 
++    bedtools_227_or_later : bool
++        In version 2.27, BEDTools changed the output for merge. By default,
++        this function expects BEDTools version 2.27 or later, but set this to
++        False to assume the older behavior.
++
++        For testing purposes, the environment variable
++        GFFUTILS_USES_BEDTOOLS_227_OR_LATER is set to either "true" or "false"
++        and is used to override this argument.
++
+     Examples
+     --------
+ 
+@@ -146,7 +156,22 @@
+ 
+ 
+     """
+-    _merge_kwargs = dict(o='distinct', s=True, c=4)
++    _override = os.environ.get('GFFUTILS_USES_BEDTOOLS_227_OR_LATER', None)
++    if _override is not None:
++        if _override == 'true':
++            bedtools_227_or_later = True
++        elif _override == 'false':
++            bedtools_227_or_later = False
++        else:
++            raise ValueError(
++                "Unknown value for GFFUTILS_USES_BEDTOOLS_227_OR_LATER "
++                "environment variable: {0}".format(_override))
++
++    if bedtools_227_or_later:
++        _merge_kwargs = dict(o='distinct', s=True, c='4,5,6')
++    else:
++        _merge_kwargs = dict(o='distinct', s=True, c='4')
++
+     if merge_kwargs is not None:
+         _merge_kwargs.update(merge_kwargs)
+ 
+@@ -195,18 +220,18 @@
+         x = x.each(to_bed).saveas()
+ 
+     if merge_overlapping:
+-
+-        def fix_merge(f):
+-            f = featurefuncs.extend_fields(f, 6)
+-            return pybedtools.Interval(
+-                f.chrom,
+-                f.start,
+-                f.stop,
+-                f[4],
+-                '.',
+-                f[3])
+-
+-        x = x.merge(**_merge_kwargs).each(fix_merge).saveas()
+-
++        if bedtools_227_or_later:
++            x = x.merge(**_merge_kwargs)
++        else:
++            def fix_merge(f):
++                f = featurefuncs.extend_fields(f, 6)
++                return pybedtools.Interval(
++                    f.chrom,
++                    f.start,
++                    f.stop,
++                    f[4],
++                    '.',
++                    f[3])
++            x = x.merge(**_merge_kwargs).saveas().each(fix_merge).saveas()
+ 
+     return x


=====================================
debian/patches/py37
=====================================
@@ -0,0 +1,20 @@
+From 7ecd042d46d88ea6f4e1baabaa4421bc0954f284 Mon Sep 17 00:00:00 2001
+From: Abishek <jesuisabhishek at gmail.com>
+Date: Fri, 22 Feb 2019 01:46:07 +0530
+Subject: [PATCH] "raise StopIteration" to "return"
+
+---
+ gffutils/iterators.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- python-gffutils.orig/gffutils/iterators.py
++++ python-gffutils/gffutils/iterators.py
+@@ -130,7 +130,7 @@
+             self.current_item_number = i
+ 
+             if line == '##FASTA' or line.startswith('>'):
+-                raise StopIteration
++                return
+ 
+             if line.startswith('##'):
+                 self._directive_handler(line)


=====================================
debian/patches/python3
=====================================
@@ -0,0 +1,18 @@
+Author: Michael R. Crusoe <michael.crusoe at gmail.com>
+Description: set #! early so help2man works easily
+--- python-gffutils.orig/gffutils/scripts/gffutils-cli
++++ python-gffutils/gffutils/scripts/gffutils-cli
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ from __future__ import print_function
+ 
+--- python-gffutils.orig/gffutils/scripts/gffutils-flybase-convert.py
++++ python-gffutils/gffutils/scripts/gffutils-flybase-convert.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ import os
+ import logging


=====================================
debian/patches/series
=====================================
@@ -0,0 +1,4 @@
+py37
+newer_bedtools
+flexible_tests
+python3


=====================================
debian/rules
=====================================
@@ -1,9 +1,56 @@
 #!/usr/bin/make -f
+SHELL=bash  # needed for the <(echo …) process subsitution temporary file
 
 DH_VERBOSE := 1
 
+include /usr/share/dpkg/pkg-info.mk
+
 export PYBUILD_NAME=gffutils
-export PYBUILD_DISABLE=test  # https://github.com/daler/gffutils/issues/91
+export PYBUILD_TEST_ARGS=--with-doctest -a '!slow'
+export PYBUILD_AFTER_TEST=find . -name tmp.db -delete
 
 %:
 	dh $@ --with python3 --buildsystem=pybuild
+
+override_dh_auto_build:
+	dh_auto_build
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --name="Command line interface for python-gffutils." \
+		   gffutils-cli > debian/gffutils-cli.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_fetch \- Fetch IDs") \
+		   'gffutils-cli fetch' > debian/gffutils-cli-fetch.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_children \- Fetch children from the database according to ID") \
+		   'gffutils-cli children' > debian/gffutils-cli-children.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_parents \- Fetch parents from the database according to ID") \
+		   'gffutils-cli parents' > debian/gffutils-cli-parents.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_region \- Returns features within provided genomic coordinates") \
+		   'gffutils-cli region' > debian/gffutils-cli-region.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_create \- Create a database") \
+		   'gffutils-cli create' > debian/gffutils-cli-create.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_common \- Identify child features in common") \
+		   'gffutils-cli common' > debian/gffutils-cli-common.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_clean \- Perform various QC operations to clean a GFF or GTF file") \
+		   'gffutils-cli clean' > debian/gffutils-cli-clean.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_sanitize \- Sanitize a GFF file") \
+		   'gffutils-cli sanitize' > debian/gffutils-cli-sanitize.1
+	PYTHONPATH=$(CURDIR) PATH=$(CURDIR)/gffutils/scripts/:$(PATH) \
+		   help2man --version-string=${DEB_VERSION_UPSTREAM} --no-info \
+		   --include <(echo -e "[NAME]\ngffutils-cli_rmdups \- Remove duplicates from a GFF file") \
+		   'gffutils-cli rmdups' > debian/gffutils-cli-rmdups.1


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,3 @@
+Tests: run-tests
+Depends: python3-gffutils, python3-nose
+Restrictions: allow-stderr


=====================================
debian/tests/run-tests
=====================================
@@ -0,0 +1,10 @@
+#!/bin/sh -ex
+
+pkg=packagename
+if [ "$ADTTMP" = "" ] ; then
+        ADTTMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+fi
+cd "$ADTTMP"
+export HOME="${ADTTMP}"
+cp -r /usr/lib/python3/dist-packages/gffutils/test ./
+nosetests3 --with-doctest -a '!slow' test


=====================================
debian/upstream/metadata
=====================================
@@ -1,7 +1,8 @@
 Registry:
- - Name: OMICtools
-   Entry: OMICS_23488
- - Name: SciCrunch
-   Entry: NA
- - Name: bio.tools
-   Entry: GFFutils
+- Name: OMICtools
+  Entry: OMICS_23488
+- Name: SciCrunch
+  Entry: NA
+- Name: bio.tools
+  Entry: GFFutils
+Name: gffutils



View it on GitLab: https://salsa.debian.org/med-team/python-gffutils/compare/8de2e99908043d5d7a054c903cbb9f79eeb8e728...7605e063b9b1f4dfbf61173f45c26e1f1daf1a13

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-gffutils/compare/8de2e99908043d5d7a054c903cbb9f79eeb8e728...7605e063b9b1f4dfbf61173f45c26e1f1daf1a13
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190924/6c21f3cc/attachment-0001.html>


More information about the debian-med-commit mailing list