Skip to content
Commits on Source (14)
python-gffutils (0.9-2) UNRELEASED; urgency=medium
python-gffutils (0.9-2) unstable; urgency=medium
* debhelper 11
-- Michael R. Crusoe <michael.crusoe@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@gmail.com> Tue, 24 Sep 2019 16:58:24 +0200
python-gffutils (0.9-1) unstable; urgency=medium
......
......@@ -4,7 +4,7 @@ Uploaders: Michael R. Crusoe <michael.crusoe@gmail.com>,
Steffen Moeller <moeller@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
......
# 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
From: Michael R. Crusoe <michael.crusoe@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():
From c602ddef45e5f4734b38ccaf36ad766ac2978273 Mon Sep 17 00:00:00 2001
From: Ryan Dale <dalerr@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
From 7ecd042d46d88ea6f4e1baabaa4421bc0954f284 Mon Sep 17 00:00:00 2001
From: Abishek <jesuisabhishek@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)
Author: Michael R. Crusoe <michael.crusoe@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
py37
newer_bedtools
flexible_tests
python3
#!/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
Tests: run-tests
Depends: python3-gffutils, python3-nose
Restrictions: allow-stderr
#!/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
......@@ -5,3 +5,4 @@ Registry:
Entry: NA
- Name: bio.tools
Entry: GFFutils
Name: gffutils