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

Nilesh Patra gitlab at salsa.debian.org
Sat Dec 12 13:04:11 GMT 2020



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


Commits:
008eb56e by Nilesh Patra at 2020-12-12T18:30:05+05:30
New upstream version 0.5.9.2
- - - - -


1 changed file:

- pyfaidx/__init__.py


Changes:

=====================================
pyfaidx/__init__.py
=====================================
@@ -29,7 +29,7 @@ if sys.version_info > (3, ):
 
 dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)')
 
-__version__ = '0.5.9.1'
+__version__ = '0.5.9.2'
 
 
 class KeyFunctionError(ValueError):
@@ -659,11 +659,12 @@ class Faidx(object):
 
         # Calculate offset (https://github.com/samtools/htslib/blob/20238f354894775ed22156cdd077bc0d544fa933/faidx.c#L398)
         newlines_before = int(
-            (start0 - 1) / i.lenc * (i.lenb - i.lenc)) if start0 > 0 and i.lenc else 0
-        newlines_to_end = int(end / i.lenc * (i.lenb - i.lenc)) if i.lenc else 0
+            (start0 - 1) / i.lenc) if start0 > 0 and i.lenc else 0
+        newlines_to_end = int(end / i.lenc) if i.lenc else 0
         newlines_inside = newlines_to_end - newlines_before
-        seq_blen = newlines_inside + seq_len
-        bstart = i.offset + newlines_before + start0
+        newline_blen = i.lenb - i.lenc
+        seq_blen = newlines_inside * newline_blen + seq_len
+        bstart = i.offset + newlines_before * newline_blen + start0
         if seq_blen < 0 and self.strict_bounds:
             raise FetchError("Requested coordinates start={0:n} end={1:n} are "
                              "invalid.\n".format(start, end))
@@ -674,7 +675,7 @@ class Faidx(object):
         with self.lock:
             if self._bgzf:  # We can't add to virtual offsets, so we need to read from the beginning of the record and trim the beginning if needed
                 self.file.seek(i.offset)
-                chunk = start0 + newlines_before + newlines_inside + seq_len
+                chunk = start0 + (newlines_before * newline_blen) + (newlines_inside * newline_blen) + seq_len
                 chunk_seq = self.file.read(chunk).decode()
                 seq = chunk_seq[start0 + newlines_before:]
             else:



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

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/commit/008eb56e8527dd1578c066f3a734dab683318b7a
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/20201212/8585a454/attachment-0001.html>


More information about the debian-med-commit mailing list