[med-svn] [Git][med-team/python-pyfaidx][master] 6 commits: New upstream version 0.5.9.1
Andreas Tille
gitlab at salsa.debian.org
Tue Sep 29 08:44:57 BST 2020
Andreas Tille pushed to branch master at Debian Med / python-pyfaidx
Commits:
9b47e8cb by Andreas Tille at 2020-09-29T09:37:21+02:00
New upstream version 0.5.9.1
- - - - -
8f8f0da8 by Andreas Tille at 2020-09-29T09:37:21+02:00
routine-update: New upstream version
- - - - -
bf00607e by Andreas Tille at 2020-09-29T09:37:22+02:00
Update upstream source from tag 'upstream/0.5.9.1'
Update to upstream version '0.5.9.1'
with Debian dir 398bff78477fbba669a1267dff6ff93263c816c6
- - - - -
fb1d383f by Andreas Tille at 2020-09-29T09:37:22+02:00
routine-update: debhelper-compat 13
- - - - -
d9bf34b1 by Andreas Tille at 2020-09-29T09:37:25+02:00
routine-update: Add salsa-ci file
- - - - -
a3643914 by Andreas Tille at 2020-09-29T09:37:25+02:00
routine-update: Rules-Requires-Root: no
- - - - -
6 changed files:
- .travis.yml
- debian/changelog
- debian/control
- + debian/salsa-ci.yml
- pyfaidx/__init__.py
- tests/test_feature_indexing.py
Changes:
=====================================
.travis.yml
=====================================
@@ -1,8 +1,9 @@
language: python
sudo: required
-dist: xenial
+dist: bionic
python:
- 'nightly'
+ - '3.8'
- '3.7'
- '3.6'
- '3.5'
@@ -10,8 +11,8 @@ python:
- 'pypy'
- 'pypy3'
install:
- - pip wheel -f wheelhouse cython pysam numpy || true
- - pip install -f wheelhouse cython pysam biopython requests coverage pyfasta pyvcf numpy || true
+ - pip install cython pysam requests coverage pyfasta pyvcf numpy
+ - pip install biopython || true
- python setup.py install
- if [ ! -f samtools-1.2 ]; then curl -sL https://github.com/samtools/samtools/releases/download/1.2/samtools-1.2.tar.bz2 | tar -xjv; fi
- cd samtools-1.2
@@ -23,8 +24,10 @@ install:
- make
- export PATH=$PATH:$PWD
- cd ..
-before_script:
- - python tests/data/download_gene_fasta.py
+before_install:
+ - sudo apt-get install -y python3.6 python3-pip
+ - env python3.6 -m pip install biopython requests
+ - env python3.6 tests/data/download_gene_fasta.py
script: nosetests --with-coverage --cover-package=pyfaidx
deploy:
provider: pypi
@@ -33,7 +36,7 @@ deploy:
secure: MbSaeuitkVTZqxa0PJ3RcR1aMf+B/sMbcx2sWOo9xfLlRFDFpYWJZ0EfXWEhrVu2YWXpBsasgunTDWSi0jNcZMH92MzOC+UTVYr45LO5sy6hm4iSiAgm/DPgYWdjP0SFKr7eL/HWPS+gHvgkXL1upleX21O358bxaezoasuKFvs=
on:
all_branches: true
- python: 3.7
+ python: 3.8
tags: true
repo: mdshw5/pyfaidx
matrix:
@@ -57,7 +60,6 @@ cache:
- tests/data
- samtools-1.2
- htslib-1.4
- - wheelhouse
after_success:
- bash <(curl -s https://codecov.io/bash)
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+python-pyfaidx (0.5.9.1-1) UNRELEASED; urgency=medium
+
+ * New upstream version
+ * debhelper-compat 13 (routine-update)
+ * Add salsa-ci file (routine-update)
+ * Rules-Requires-Root: no (routine-update)
+
+ -- Andreas Tille <tille at debian.org> Tue, 29 Sep 2020 09:37:21 +0200
+
python-pyfaidx (0.5.8-2) unstable; urgency=medium
* Build-Depends: tabix <!nocheck>
=====================================
debian/control
=====================================
@@ -4,7 +4,7 @@ Uploaders: Andreas Tille <tille at debian.org>
Section: python
Testsuite: autopkgtest-pkg-python
Priority: optional
-Build-Depends: debhelper-compat (= 12),
+Build-Depends: debhelper-compat (= 13),
dh-python,
python3-all,
python3-coverage,
@@ -19,6 +19,7 @@ Standards-Version: 4.5.0
Vcs-Browser: https://salsa.debian.org/med-team/python-pyfaidx
Vcs-Git: https://salsa.debian.org/med-team/python-pyfaidx.git
Homepage: https://github.com/mdshw5/pyfaidx
+Rules-Requires-Root: no
Package: python3-pyfaidx
Architecture: all
=====================================
debian/salsa-ci.yml
=====================================
@@ -0,0 +1,4 @@
+---
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
=====================================
pyfaidx/__init__.py
=====================================
@@ -4,28 +4,32 @@ Fasta file -> Faidx -> Fasta -> FastaRecord -> Sequence
"""
from __future__ import division
+
import os
+import re
+import string
import sys
+import warnings
+from collections import namedtuple
+from itertools import islice
+from math import ceil
from os.path import getmtime
-from six import PY2, PY3, string_types, integer_types
+from threading import Lock
+
+from six import PY2, PY3, integer_types, string_types
from six.moves import zip_longest
+
try:
from collections import OrderedDict
except ImportError: #python 2.6
from ordereddict import OrderedDict
-from collections import namedtuple
-import re
-import string
-import warnings
-from math import ceil
-from threading import Lock
if sys.version_info > (3, ):
buffer = memoryview
dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)')
-__version__ = '0.5.8'
+__version__ = '0.5.9.1'
class KeyFunctionError(ValueError):
@@ -301,7 +305,7 @@ class IndexRecord(
return tuple.__getitem__(self, key)
def __str__(self):
- return "{rlen:n}\t{offset:n}\t{lenc:n}\t{lenb:n}\n".format(
+ return "{rlen:d}\t{offset:d}\t{lenc:d}\t{lenb:d}".format(
**self._asdict())
def __len__(self):
@@ -456,7 +460,7 @@ class Faidx(object):
def _index_as_string(self):
""" Returns the string representation of the index as iterable """
for k, v in self.index.items():
- yield '\t'.join([k, str(v)])
+ yield '{k}\t{v}\n'.format(k=k, v=str(v))
def read_fai(self):
try:
@@ -603,7 +607,7 @@ class Faidx(object):
def write_fai(self):
with self.lock:
with open(self.indexname, 'w') as outfile:
- for line in self._index_as_string:
+ for line in self._index_as_string():
outfile.write(line)
def from_buffer(self, start, end):
@@ -1015,7 +1019,7 @@ class Fasta(object):
def __getitem__(self, rname):
"""Return a chromosome by its name, or its numerical index."""
if isinstance(rname, integer_types):
- rname = tuple(self.keys())[rname]
+ rname = next(islice(self.records.keys(), rname, None))
try:
return self.records[rname]
except KeyError:
@@ -1025,9 +1029,8 @@ class Fasta(object):
return 'Fasta("%s")' % (self.filename)
def __iter__(self):
- for rname in self.keys():
- yield self[rname]
-
+ return iter(self.records.values())
+
def __len__(self):
"""Return the cumulative length of all FastaRecords in self.records."""
return sum(len(record) for record in self)
=====================================
tests/test_feature_indexing.py
=====================================
@@ -317,12 +317,24 @@ class TestIndexing(TestCase):
finally:
shutil.rmtree(tmp_dir)
+ def test_read_back_index(self):
+ """Ensure that index files written with write_fai() can be read back"""
+ import locale
+ old_locale = locale.getlocale(locale.LC_NUMERIC)
+ try:
+ locale.setlocale(locale.LC_NUMERIC, 'en_US.utf8')
+ faidx = Faidx('data/genes.fasta')
+ faidx.write_fai()
+ faidx = Faidx('data/genes.fasta', build_index=False)
+ finally:
+ locale.setlocale(locale.LC_NUMERIC, old_locale)
+
@raises(IndexNotFoundError)
def test_issue_134_no_build_index(self):
""" Ensure that index file is not built when build_index=False. See mdshw5/pyfaidx#134.
"""
faidx = Faidx('data/genes.fasta', build_index=False)
-
+
@raises(FastaIndexingError)
def test_issue_144_no_defline(self):
""" Ensure that an exception is raised when a file contains no deflines. See mdshw5/pyfaidx#144.
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/compare/51d71bee604b0046059fc6c8855691395bec9985...a36439141c1d163045fdbcc73dc761eb2722195b
--
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/compare/51d71bee604b0046059fc6c8855691395bec9985...a36439141c1d163045fdbcc73dc761eb2722195b
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/20200929/d66bd3fc/attachment-0001.html>
More information about the debian-med-commit
mailing list