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

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Fri Sep 3 15:55:18 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / python-pyfaidx


Commits:
17438b7c by Nilesh Patra at 2021-09-03T20:15:48+05:30
New upstream version 0.6.2
- - - - -


6 changed files:

- − .gitignore
- − .travis.yml
- README.rst
- pyfaidx/__init__.py
- pyfaidx/cli.py
- setup.cfg


Changes:

=====================================
.gitignore deleted
=====================================
@@ -1,12 +0,0 @@
-/build
-venv
-__pycache__
-*.pyc
-.project
-.pydevproject
-.idea
-*.egg-info
-.tox
-.coverage
-.coverage.*
-tests/data/chr22*


=====================================
.travis.yml deleted
=====================================
@@ -1,65 +0,0 @@
-language: python
-sudo: required
-dist: bionic
-python:
-    - 'nightly'
-    - '3.8'
-    - '3.7'
-    - '3.6'
-    - '3.5'
-    - '2.7'
-    - 'pypy'
-    - 'pypy3'
-install:
-    - 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
-    - make
-    - export PATH=$PATH:$PWD
-    - cd ..
-    - if [ ! -f htslib-1.4 ]; then curl -sL https://github.com/samtools/htslib/releases/download/1.4/htslib-1.4.tar.bz2 | tar -xjv; fi
-    - cd htslib-1.4
-    - make
-    - export PATH=$PATH:$PWD
-    - cd ..
-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
-  user: mdshw5
-  password:
-    secure: MbSaeuitkVTZqxa0PJ3RcR1aMf+B/sMbcx2sWOo9xfLlRFDFpYWJZ0EfXWEhrVu2YWXpBsasgunTDWSi0jNcZMH92MzOC+UTVYr45LO5sy6hm4iSiAgm/DPgYWdjP0SFKr7eL/HWPS+gHvgkXL1upleX21O358bxaezoasuKFvs=
-  on:
-    all_branches: true
-    python: 3.8
-    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
-    - os: windows
-  fast_finish: true
-cache:
-    directories:
-        - tests/data
-        - samtools-1.2
-        - htslib-1.4
-after_success:
-    - bash <(curl -s https://codecov.io/bash)
-


=====================================
README.rst
=====================================
@@ -356,7 +356,7 @@ cli script: faidx
 
     optional arguments:
       -h, --help            show this help message and exit
-      -b BED, --bed BED     bed file of regions
+      -b BED, --bed BED     bed file of regions (zero-based start coordinate)
       -o OUT, --out OUT     output file name (default: stdout)
       -i {bed,chromsizes,nucleotide,transposed}, --transform {bed,chromsizes,nucleotide,transposed} transform the requested regions into another format. default: None
       -c, --complement      complement the sequence. default: False
@@ -593,8 +593,8 @@ Wheelan <http://sjwheelan.som.jhmi.edu>`_ and `Vasan
 Yegnasubramanian <http://yegnalab.onc.jhmi.edu>`_ at the Sidney Kimmel
 Comprehensive Cancer Center in the Department of Oncology.
 
-.. |Travis| image:: https://travis-ci.org/mdshw5/pyfaidx.svg?branch=master
-    :target: https://travis-ci.org/mdshw5/pyfaidx
+.. |Travis| image:: https://travis-ci.com/mdshw5/pyfaidx.svg?branch=master
+    :target: https://travis-ci.com/mdshw5/pyfaidx
 
 .. |PyPI| image:: https://img.shields.io/pypi/v/pyfaidx.svg?branch=master
     :target: https://pypi.python.org/pypi/pyfaidx


=====================================
pyfaidx/__init__.py
=====================================
@@ -9,6 +9,7 @@ import os
 import re
 import string
 import sys
+import shutil
 import warnings
 from collections import namedtuple
 from itertools import islice
@@ -29,7 +30,7 @@ if sys.version_info > (3, ):
 
 dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)')
 
-__version__ = '0.5.9.5'
+__version__ = '0.6.2'
 
 
 class KeyFunctionError(ValueError):
@@ -437,8 +438,8 @@ class Faidx(object):
                     self.read_fai()
 
             except FastaIndexingError:
-                os.remove(self.indexname)
                 self.file.close()
+                os.remove(self.indexname + '.tmp')
                 raise
             except Exception:
                 # Handle potential exceptions other than 'FastaIndexingError'
@@ -515,7 +516,7 @@ class Faidx(object):
     def build_index(self):
         try:
             with self._fasta_opener(self.filename, 'rb') as fastafile:
-                with open(self.indexname, 'w') as indexfile:
+                with open(self.indexname + '.tmp', 'w') as indexfile:
                     rname = None  # reference sequence name
                     offset = 0  # binary offset of end of current line
                     rlen = 0  # reference character length
@@ -596,6 +597,7 @@ class Faidx(object):
                                 "Inconsistent line found in >{0} at "
                                 "line {1:n}.".format(rname,
                                                      bad_lines[0][0] + 1))
+            shutil.move(self.indexname + '.tmp', self.indexname)
         except (IOError, FastaIndexingError) as e:
             if isinstance(e, IOError):
                 raise IOError(


=====================================
pyfaidx/cli.py
=====================================
@@ -117,6 +117,10 @@ def split_regions(args):
 def transform_sequence(args, fasta, name, start=None, end=None):
     line_len = fasta.faidx.index[name].lenc
     s = fasta[name][start:end]
+    if args.complement:
+        s = s.complement
+    if args.reverse:
+        s = s.reverse
     if args.no_output:
         return
     if args.transform == 'bed':
@@ -148,7 +152,7 @@ def main(ext_args=None):
     _input = parser.add_argument_group('input options')
     output = parser.add_argument_group('output options')
     header = parser.add_argument_group('header options')
-    _input.add_argument('-b', '--bed', type=argparse.FileType('r'), help="bed file of regions")
+    _input.add_argument('-b', '--bed', type=argparse.FileType('r'), help="bed file of regions (zero-based start coordinate)")
     output.add_argument('-o', '--out', type=argparse.FileType('w'), help="output file name (default: stdout)")
     output.add_argument('-i', '--transform', type=str, choices=('bed', 'chromsizes', 'nucleotide', 'transposed'), help="transform the requested regions into another format. default: %(default)s")
     output.add_argument('-c', '--complement', action="store_true", default=False, help="complement the sequence. default: %(default)s")


=====================================
setup.cfg
=====================================
@@ -1,3 +1,4 @@
 [nosetests]
 with-doctest=1
 verbosity=2
+with-ignore-docstrings=1
\ No newline at end of file



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

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/commit/17438b7c77cd39a202a0da600c9a6ce837edd4bd
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/20210903/397c68f9/attachment-0001.htm>


More information about the debian-med-commit mailing list