[med-svn] [Git][med-team/python-pyfaidx][upstream] New upstream version 0.5.8

Steffen Möller gitlab at salsa.debian.org
Sat Jan 25 18:11:30 GMT 2020



Steffen Möller pushed to branch upstream at Debian Med / python-pyfaidx


Commits:
92d28927 by Steffen Moeller at 2020-01-25T18:58:50+01:00
New upstream version 0.5.8
- - - - -


6 changed files:

- .travis.yml
- − appveyor.yml
- − ci/appveyor/vcvars64.bat
- pyfaidx/__init__.py
- tests/data/download_gene_fasta.py
- − tox.ini


Changes:

=====================================
.travis.yml
=====================================
@@ -6,14 +6,12 @@ python:
     - '3.7'
     - '3.6'
     - '3.5'
-    - '3.4'
     - '2.7'
     - 'pypy'
     - 'pypy3'
 install:
     - pip wheel -f wheelhouse cython pysam numpy || true
-    - pip install -f wheelhouse cython pysam pyfasta coverage pyvcf numpy || true
-    - pip install -f wheelhouse -e git+https://github.com/biopython/biopython.git#egg=biopython || true
+    - pip install -f wheelhouse cython pysam biopython requests coverage pyfasta pyvcf numpy || 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
@@ -26,8 +24,7 @@ install:
     - export PATH=$PATH:$PWD
     - cd ..
 before_script:
-    - if [ $(python --version) -gt 2.6 ]; then env pip install biopython; fi
-    - env python tests/data/download_gene_fasta.py
+    - python tests/data/download_gene_fasta.py
 script: nosetests --with-coverage --cover-package=pyfaidx
 deploy:
   provider: pypi
@@ -36,14 +33,24 @@ deploy:
     secure: MbSaeuitkVTZqxa0PJ3RcR1aMf+B/sMbcx2sWOo9xfLlRFDFpYWJZ0EfXWEhrVu2YWXpBsasgunTDWSi0jNcZMH92MzOC+UTVYr45LO5sy6hm4iSiAgm/DPgYWdjP0SFKr7eL/HWPS+gHvgkXL1upleX21O358bxaezoasuKFvs=
   on:
     all_branches: true
-    python: 3.6
+    python: 3.7
     tags: true
     repo: mdshw5/pyfaidx
 matrix:
+  include:
+    - os: windows
+      language: sh
+      python: "3.7"
+      before_install:
+        - choco install python3
+        - export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
+        - python -m virtualenv $HOME/venv
+        - source $HOME/venv/Scripts/activate
   allow_failures:
-    - python: 'nightly'
-    - python: 'pypy3'
-    - python: 'pypy'
+    - python: nightly
+    - python: pypy3
+    - python: pypy
+    - os: windows
   fast_finish: true
 cache:
     directories:
@@ -53,4 +60,4 @@ cache:
         - wheelhouse
 after_success:
     - bash <(curl -s https://codecov.io/bash)
-    - if [ $TRAVIS_PYTHON_VERSION == '3.4' ] && [ $TRAVIS_TAG ]; then python scripts/benchmark.py 1000; fi
+


=====================================
appveyor.yml deleted
=====================================
@@ -1,31 +0,0 @@
-environment:
-
-  matrix:
-
-    # For Python versions available on Appveyor, see
-    # http://www.appveyor.com/docs/installed-software#python
-
-    - PYTHON: "C:\\Python27"
-    - PYTHON: "C:\\Python33"
-    - PYTHON: "C:\\Python34"
-    - PYTHON: "C:\\Python35"
-    - PYTHON: "C:\\Python27-x64"
-    - PYTHON: "C:\\Python33-x64"
-      DISTUTILS_USE_SDK: "1"
-    - PYTHON: "C:\\Python34-x64"
-      DISTUTILS_USE_SDK: "1"
-    - PYTHON: "C:\\Python35-x64"
-
-install:
-  # Fix for problem building extensions for x64 under Python 3.3 and 3.4
-  # See: http://help.appveyor.com/discussions/problems/4278-cant-build-some-c-extensions-with-python-34-x64
-  # Used same solution as Matplotlib: https://github.com/matplotlib/matplotlib/blob/master/appveyor.yml
-  - cmd: copy ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64"
-
-  # We need wheel installed to build wheels
-  - "%PYTHON%\\python.exe -m pip install -r dev-requirements.txt"
-
-build: off
-
-test_script:
-  - "%PYTHON%\\python.exe setup.py nosetests"


=====================================
ci/appveyor/vcvars64.bat deleted
=====================================
@@ -1 +0,0 @@
-CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64


=====================================
pyfaidx/__init__.py
=====================================
@@ -25,7 +25,7 @@ if sys.version_info > (3, ):
 
 dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)')
 
-__version__ = '0.5.7'
+__version__ = '0.5.8'
 
 
 class KeyFunctionError(ValueError):
@@ -198,6 +198,13 @@ class Sequence(object):
         """
         return len(self.seq)
 
+    def __eq__(self, other):
+        """
+        >>> Sequence('chr1', 'ACT') == 'ACT'
+        True
+        """
+        return str(self) == str(other)
+
     @property
     def fancy_name(self):
         """ Return the fancy name for the sequence, including start, end, and complementation.
@@ -1020,6 +1027,10 @@ class Fasta(object):
     def __iter__(self):
         for rname in self.keys():
             yield self[rname]
+            
+    def __len__(self):
+        """Return the cumulative length of all FastaRecords in self.records."""
+        return sum(len(record) for record in self)
 
     def get_seq(self, name, start, end, rc=False):
         """Return a sequence by record name and interval [start, end).


=====================================
tests/data/download_gene_fasta.py
=====================================
@@ -34,15 +34,13 @@ def fetch_genes(filename, suffix=None):
                 lower.write(line)
 
 def fetch_chr22(filename):
-    from subprocess import Popen, PIPE
+    import requests
+    import gzip
 
-    grch36 = 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/technical/reference/human_b36_male.fa.gz'
-    curl = Popen(['curl', '-s', grch36], stdout=PIPE)
-    gz = Popen(['gzip', '-dcq'], stdin=curl.stdout, stdout=PIPE)
-    with gz.stdout as remote:
-        with open(filename, 'w') as fasta:
+    with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/technical/reference/human_b36_male.fa.gz') as compressed:
+        with open(filename, 'w') as fasta, gzip.GzipFile(fileobj=compressed.raw) as gz:
             chr22 = False
-            for line in remote:
+            for line in gz:
                 if line[0:3] == '>22':
                     fasta.write(line)
                     chr22 = True
@@ -66,17 +64,20 @@ def fake_chr22(filename):
         fake_file.write('N' * mod_70 + '\n')
 
 def bgzip_compress_fasta(filename):
-    from subprocess import call
-    call(' '.join(['bgzip', '-c', filename, '>', filename + '.gz']), shell=True)
-
+    from Bio.bgzf import BgzfWriter
+    with BgzfWriter(filename=filename + '.gz') as compressed, open(filename, 'r') as fasta:
+        for line in fasta:
+            compressed.write(line)
 
 def fetch_chr22_vcf(filename):
-    from subprocess import call
-    call(['curl', '-s', 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz',
-          '-o', filename])
-    call(['curl', '-s', 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz.tbi',
-          '-o', filename + '.tbi'])
-
+    import requests
+    
+    with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz') as vcf:
+        with open(filename, 'wb') as out:
+            out.write(vcf.content)
+    with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz.tbi') as tbi:
+        with open(filename + '.tbi', 'wb') as out:
+            out.write(tbi.content)
 
 
 if __name__ == "__main__":


=====================================
tox.ini deleted
=====================================
@@ -1,27 +0,0 @@
-[tox]
-envlist = init, py26, py27, py33, py34, py35, pypy, pypy3, final
-
-[testenv]
-deps = nose
-       mock; python_version < '3.3'
-       coverage
-       nose-cov
-       biopython
-       pysam; python_version > '2.6' and platform_python_implementation != 'PyPy'
-       pyvcf
-commands = nosetests --with-cov --cov-report term-missing --cov {envsitepackagesdir}/pyfaidx -P tests
-           coverage combine
-           bash -c 'mv {toxinidir}/.coverage {toxworkdir}/.coverage.{envname}'
-whitelist_externals = bash
-
-[testenv:init]
-basepython = python2.7
-commands = coverage erase
-           bash -c 'rm -rf {toxworkdir}/.coverage.*'
-           python tests/data/download_gene_fasta.py
-
-[testenv:final]
-basepython = python2.7
-commands = coverage combine {toxworkdir}
-           coverage report -m
-



View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/commit/92d289273102abe7d5dcaae86b0e5e25016ad246

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/commit/92d289273102abe7d5dcaae86b0e5e25016ad246
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/20200125/c818f653/attachment-0001.html>


More information about the debian-med-commit mailing list