[med-svn] [Git][med-team/python-pyfaidx][master] 6 commits: New upstream version 0.7.1
Andreas Tille (@tille)
gitlab at salsa.debian.org
Thu Aug 25 16:42:27 BST 2022
Andreas Tille pushed to branch master at Debian Med / python-pyfaidx
Commits:
ef2f5ad8 by Andreas Tille at 2022-08-25T14:03:17+02:00
New upstream version 0.7.1
- - - - -
0cec6904 by Andreas Tille at 2022-08-25T14:03:17+02:00
routine-update: New upstream version
- - - - -
f5f13258 by Andreas Tille at 2022-08-25T14:03:17+02:00
Update upstream source from tag 'upstream/0.7.1'
Update to upstream version '0.7.1'
with Debian dir 1219633f6ced4e7e613de276a02bc35131f9fe70
- - - - -
eaf00a3e by Andreas Tille at 2022-08-25T14:03:20+02:00
Remove duplicate line from changelog.
Changes-By: lintian-brush
- - - - -
de98ead2 by Andreas Tille at 2022-08-25T17:21:52+02:00
Refresh patches
- - - - -
8e1a3a40 by Andreas Tille at 2022-08-25T17:23:08+02:00
Upload to unstable
- - - - -
6 changed files:
- README.rst
- debian/changelog
- debian/patches/fix-pkg-resources.patch
- debian/patches/test-locale-to-c.patch
- pyfaidx/__init__.py
- + tests/test_Path.py
Changes:
=====================================
README.rst
=====================================
@@ -26,7 +26,7 @@ If you use pyfaidx in your publication, please cite:
Installation
------------
-This package is tested under Linux and macOS using Python 3.6+, and and is available from the PyPI:
+This package is tested under Linux and macOS using Python 3.7+, and and is available from the PyPI:
::
@@ -335,6 +335,17 @@ The FastaVariant class provides a way to integrate single nucleotide variant cal
>>> consensus = FastaVariant('tests/data/chr22.fasta', 'tests/data/chr22.vcf.gz', sample='NA06984', het=True, hom=True, call_filter='GT == "0/1"')
>>> consensus['22'].variant_sites
(16042793, 29187373, 29187448, 29194610, 29821332)
+
+You can also specify paths using ``pathlib.Path`` objects.
+
+.. code:: python
+
+ #new in v0.7.1
+ >>> from pyfaidx import Fasta
+ >>> from pathlib import Path
+ >>> genes = Fasta(Path('tests/data/genes.fasta'))
+ >>> genes
+ Fasta("tests/data/genes.fasta")
Accessing fasta files from `filesystem_spec <https://filesystem-spec.readthedocs.io>`_ filesystems:
=====================================
debian/changelog
=====================================
@@ -1,10 +1,10 @@
-python-pyfaidx (0.7.0-1) UNRELEASED; urgency=medium
+python-pyfaidx (0.7.1-1) unstable; urgency=medium
* New upstream version
* Standards-Version: 4.6.1 (routine-update)
* d/watch: create proper upstream file name
- -- Andreas Tille <tille at debian.org> Thu, 14 Jul 2022 16:43:48 +0200
+ -- Andreas Tille <tille at debian.org> Thu, 25 Aug 2022 17:22:01 +0200
python-pyfaidx (0.6.4-1) unstable; urgency=medium
=====================================
debian/patches/fix-pkg-resources.patch
=====================================
@@ -5,21 +5,19 @@ Forwarded: not-needed
Last-Update: 2022-02-17
--- a/pyfaidx/__init__.py
+++ b/pyfaidx/__init__.py
-@@ -6,6 +6,7 @@
- from __future__ import division
+@@ -7,6 +7,7 @@ from __future__ import division
+ import datetime
import os
+import pkg_resources
import re
import string
import sys
-@@ -25,8 +26,11 @@
- from collections import OrderedDict
- except ImportError: #python 2.6
- from ordereddict import OrderedDict
--
+@@ -33,7 +34,10 @@ try:
+ except ImportError:
+ fsspec = None
+
-__version__ = get_distribution("pyfaidx").version
-+
+try:
+ __version__ = get_distribution("pyfaidx").version
+except (ImportError, pkg_resources.DistributionNotFound):
=====================================
debian/patches/test-locale-to-c.patch
=====================================
@@ -7,7 +7,7 @@ Last-Update: 2020-09-30
--- a/tests/test_feature_indexing.py
+++ b/tests/test_feature_indexing.py
-@@ -318,7 +318,7 @@
+@@ -318,7 +318,7 @@ def test_read_back_index(remove_index):
import platform
if platform.system() == "Linux":
@@ -16,9 +16,9 @@ Last-Update: 2020-09-30
elif platform.system() == "Darwin":
new_locale = 'en_US.UTF-8'
-@@ -349,4 +349,4 @@
- fasta_out.write("CTCCGGGCCCAT\nATAAAGCCTAAA\n")
- faidx = Faidx(fasta_path)
+@@ -349,4 +349,4 @@ def test_issue_144_no_defline(remove_ind
+ with pytest.raises(FastaIndexingError):
+ faidx = Faidx(fasta_path)
finally:
- shutil.rmtree(tmp_dir)
\ No newline at end of file
=====================================
pyfaidx/__init__.py
=====================================
@@ -353,7 +353,7 @@ class Faidx(object):
Sequence() object or as a raw string.
Default: False (i.e. return a Sequence() object).
"""
-
+
if fsspec and isinstance(filename, fsspec.core.OpenFile):
self.filename = filename.path
assert getattr(filename, 'mode', 'rb') == 'rb'
@@ -1061,7 +1061,6 @@ class Fasta(object):
filename: name of fasta file or fsspec.core.OpenFile instance
indexname: name of index file or fsspec.core.OpenFile instance
"""
- self.filename = filename
self.mutable = mutable
self.faidx = Faidx(
filename,
@@ -1081,6 +1080,8 @@ class Fasta(object):
rebuild=rebuild,
build_index=build_index)
+ self.filename = self.faidx.filename
+
_record_constructor = MutableFastaRecord if self.mutable else FastaRecord
self.records = OrderedDict([(rname, _record_constructor(rname, self)) for rname in self.faidx.index.keys()])
@@ -1175,10 +1176,6 @@ class FastaVariant(Fasta):
call_filter=None,
**kwargs):
super(FastaVariant, self).__init__(filename, **kwargs)
- try:
- import pysam
- except ImportError:
- raise ImportError("pysam must be installed for FastaVariant.")
try:
import vcf
except ImportError:
=====================================
tests/test_Path.py
=====================================
@@ -0,0 +1,29 @@
+import os
+import pytest
+from pathlib import Path
+from pyfaidx import Faidx, Fasta
+
+path = os.path.dirname(__file__)
+os.chdir(path)
+
+ at pytest.fixture
+def remove_index():
+ yield
+ try:
+ os.remove('data/genes.fasta.fai')
+ except EnvironmentError:
+ pass # some tests may delete this file
+
+def test_Faidx(remove_index):
+ """ Ensures that Faidx can be created with a pathlib.Path as filename """
+ filename = 'data/genes.fasta'
+ faidx = Faidx(filename)
+ faidx_w_path = Faidx(Path(filename))
+ assert faidx.filename == faidx_w_path.filename
+
+def test_Fasta(remove_index):
+ """ Ensures that Fasta can be created with a pathlib.Path as filename """
+ filename = 'data/genes.fasta'
+ fasta = Fasta(filename)
+ fasta_w_path = Fasta(Path(filename))
+ assert fasta.filename == fasta_w_path.filename
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/compare/0211ffac8256da5dbff21c5d6049d3fdb1a42df1...8e1a3a40121e5baa150e0ba5a88d476f85bd842a
--
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/compare/0211ffac8256da5dbff21c5d6049d3fdb1a42df1...8e1a3a40121e5baa150e0ba5a88d476f85bd842a
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/20220825/5c30906d/attachment-0001.htm>
More information about the debian-med-commit
mailing list