pyfaidx 0.7.2.2__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/.coveragerc +0 -2
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/PKG-INFO +1 -2
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/dev-requirements.txt +0 -2
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx/__init__.py +15 -30
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx.egg-info/PKG-INFO +1 -2
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx.egg-info/requires.txt +0 -1
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyproject.toml +0 -1
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_Fasta_synchronization.py +1 -4
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_indexing.py +4 -8
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/.github/dependabot.yml +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/.github/workflows/main.yml +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/.github/workflows/pypi.yml +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/.gitignore +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/CODE_OF_CONDUCT.md +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/LICENSE +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/MANIFEST.in +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/README.rst +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/codecov.yml +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx/cli.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx.egg-info/SOURCES.txt +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx.egg-info/dependency_links.txt +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx.egg-info/entry_points.txt +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/pyfaidx.egg-info/top_level.txt +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/scripts/benchmark.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/setup.cfg +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/chr17.hg19.part.fa +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/download_gene_fasta.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/gene.bed12 +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/gene.bed12.fasta +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/genes.fasta +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/genes.fasta.lower +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/issue_141.fasta +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/issue_83.fasta +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/malformed.bed +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/data/regions.bed +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_FastaRecord.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_FastaRecord_iter.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_FastaVariant.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_Fasta_bgzip.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_Fasta_integer_index.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_Path.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_bio_seqio.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_faidx.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_bounds_check.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_default_seq.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_key_function.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_read_ahead_buffer.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_sequence_as_raw.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_spliced_seq.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_feature_split_char.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_fsspec.py +0 -0
- {pyfaidx-0.7.2.2 → pyfaidx-0.8.0}/tests/test_sequence_class.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyfaidx
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: pyfaidx: efficient pythonic random access to fasta subsequences
|
|
5
5
|
Author-email: Matthew Shirley <mdshw5@gmail.com>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -22,7 +22,6 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
22
22
|
Requires-Python: >=3.7
|
|
23
23
|
Description-Content-Type: text/x-rst
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: six
|
|
26
25
|
Requires-Dist: setuptools
|
|
27
26
|
Requires-Dist: importlib_metadata
|
|
28
27
|
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Fasta file -> Faidx -> Fasta -> FastaRecord -> Sequence
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from __future__ import division
|
|
7
|
-
|
|
8
6
|
import datetime
|
|
9
7
|
import os
|
|
10
8
|
import re
|
|
@@ -13,7 +11,7 @@ import sys
|
|
|
13
11
|
import shutil
|
|
14
12
|
import warnings
|
|
15
13
|
from collections import namedtuple
|
|
16
|
-
from itertools import islice
|
|
14
|
+
from itertools import islice, zip_longest
|
|
17
15
|
from math import ceil
|
|
18
16
|
from os.path import getmtime
|
|
19
17
|
from tempfile import TemporaryFile
|
|
@@ -24,13 +22,7 @@ try:
|
|
|
24
22
|
except ImportError: #python < 3.8
|
|
25
23
|
from importlib_metadata import version
|
|
26
24
|
|
|
27
|
-
from
|
|
28
|
-
from six.moves import zip_longest
|
|
29
|
-
|
|
30
|
-
try:
|
|
31
|
-
from collections import OrderedDict
|
|
32
|
-
except ImportError: #python 2.6
|
|
33
|
-
from ordereddict import OrderedDict
|
|
25
|
+
from collections import OrderedDict
|
|
34
26
|
|
|
35
27
|
try:
|
|
36
28
|
import fsspec
|
|
@@ -39,9 +31,6 @@ except ImportError:
|
|
|
39
31
|
|
|
40
32
|
__version__ = version("pyfaidx")
|
|
41
33
|
|
|
42
|
-
if sys.version_info > (3, ):
|
|
43
|
-
buffer = memoryview
|
|
44
|
-
|
|
45
34
|
dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)')
|
|
46
35
|
|
|
47
36
|
class KeyFunctionError(ValueError):
|
|
@@ -99,8 +88,8 @@ class Sequence(object):
|
|
|
99
88
|
self.start = start
|
|
100
89
|
self.end = end
|
|
101
90
|
self.comp = comp
|
|
102
|
-
assert isinstance(name,
|
|
103
|
-
assert isinstance(seq,
|
|
91
|
+
assert isinstance(name, str)
|
|
92
|
+
assert isinstance(seq, str)
|
|
104
93
|
|
|
105
94
|
def __getitem__(self, n):
|
|
106
95
|
""" Returns a sliced version of Sequence
|
|
@@ -180,7 +169,7 @@ class Sequence(object):
|
|
|
180
169
|
end = self_start + slice_stop + correction_factor
|
|
181
170
|
return self.__class__(self.name, self.seq[n], start, end,
|
|
182
171
|
self.comp)
|
|
183
|
-
elif isinstance(n,
|
|
172
|
+
elif isinstance(n, int):
|
|
184
173
|
if n < 0:
|
|
185
174
|
n = len(self) + n
|
|
186
175
|
if self.start:
|
|
@@ -455,7 +444,7 @@ class Faidx(object):
|
|
|
455
444
|
try:
|
|
456
445
|
key_fn_test = self.key_function(
|
|
457
446
|
"TestingReturnType of_key_function")
|
|
458
|
-
if not isinstance(key_fn_test,
|
|
447
|
+
if not isinstance(key_fn_test, str):
|
|
459
448
|
raise KeyFunctionError(
|
|
460
449
|
"key_function argument should return a string, not {0}".
|
|
461
450
|
format(type(key_fn_test)))
|
|
@@ -482,9 +471,9 @@ class Faidx(object):
|
|
|
482
471
|
self.lock = Lock()
|
|
483
472
|
self.buffer = dict((('seq', None), ('name', None), ('start', None),
|
|
484
473
|
('end', None)))
|
|
485
|
-
if not read_ahead or isinstance(read_ahead,
|
|
474
|
+
if not read_ahead or isinstance(read_ahead, int):
|
|
486
475
|
self.read_ahead = read_ahead
|
|
487
|
-
elif not isinstance(read_ahead,
|
|
476
|
+
elif not isinstance(read_ahead, int):
|
|
488
477
|
raise ValueError("read_ahead value must be int, not {0}".format(
|
|
489
478
|
type(read_ahead)))
|
|
490
479
|
|
|
@@ -923,7 +912,7 @@ class FastaRecord(object):
|
|
|
923
912
|
start = len(self) + start
|
|
924
913
|
return self._fa.get_seq(self.name, start + 1, stop)[::step]
|
|
925
914
|
|
|
926
|
-
elif isinstance(n,
|
|
915
|
+
elif isinstance(n, int):
|
|
927
916
|
if n < 0:
|
|
928
917
|
n = len(self) + n
|
|
929
918
|
return self._fa.get_seq(self.name, n + 1, n + 1)
|
|
@@ -1034,7 +1023,7 @@ class FastaRecord(object):
|
|
|
1034
1023
|
'shape': (len(self), ),
|
|
1035
1024
|
'typestr': '|S1',
|
|
1036
1025
|
'version': 3,
|
|
1037
|
-
'data':
|
|
1026
|
+
'data': memoryview(str(self).encode('ascii'))
|
|
1038
1027
|
}
|
|
1039
1028
|
|
|
1040
1029
|
|
|
@@ -1065,7 +1054,7 @@ class MutableFastaRecord(FastaRecord):
|
|
|
1065
1054
|
start = len(self) + start
|
|
1066
1055
|
self._fa.faidx.to_file(self.name, start + 1, stop, value)
|
|
1067
1056
|
|
|
1068
|
-
elif isinstance(n,
|
|
1057
|
+
elif isinstance(n, int):
|
|
1069
1058
|
if n < 0:
|
|
1070
1059
|
n = len(self) + n
|
|
1071
1060
|
return self._fa.faidx.to_file(self.name, n + 1, n + 1, value)
|
|
@@ -1126,7 +1115,7 @@ class Fasta(object):
|
|
|
1126
1115
|
|
|
1127
1116
|
def __getitem__(self, rname):
|
|
1128
1117
|
"""Return a chromosome by its name, or its numerical index."""
|
|
1129
|
-
if isinstance(rname,
|
|
1118
|
+
if isinstance(rname, int):
|
|
1130
1119
|
rname = next(islice(self.records.keys(), rname, None))
|
|
1131
1120
|
try:
|
|
1132
1121
|
return self.records[rname]
|
|
@@ -1353,13 +1342,9 @@ invalid_characters_set = set(
|
|
|
1353
1342
|
chr(x) for x in range(256) if chr(x) not in complement_map[0])
|
|
1354
1343
|
invalid_characters_string = ''.join(invalid_characters_set)
|
|
1355
1344
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
translate_arguments = (complement_table, )
|
|
1360
|
-
elif PY2:
|
|
1361
|
-
complement_table = string.maketrans(complement_map[0], complement_map[1])
|
|
1362
|
-
translate_arguments = (complement_table, invalid_characters_string)
|
|
1345
|
+
complement_table = str.maketrans(complement_map[0], complement_map[1],
|
|
1346
|
+
invalid_characters_string)
|
|
1347
|
+
translate_arguments = (complement_table, )
|
|
1363
1348
|
|
|
1364
1349
|
|
|
1365
1350
|
def complement(seq):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyfaidx
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: pyfaidx: efficient pythonic random access to fasta subsequences
|
|
5
5
|
Author-email: Matthew Shirley <mdshw5@gmail.com>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -22,7 +22,6 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
22
22
|
Requires-Python: >=3.7
|
|
23
23
|
Description-Content-Type: text/x-rst
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: six
|
|
26
25
|
Requires-Dist: setuptools
|
|
27
26
|
Requires-Dist: importlib_metadata
|
|
28
27
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import builtins
|
|
1
2
|
import os
|
|
2
3
|
import pytest
|
|
3
4
|
from os.path import getmtime
|
|
@@ -7,12 +8,7 @@ import time
|
|
|
7
8
|
import platform
|
|
8
9
|
import shutil
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
from unittest import mock
|
|
12
|
-
except ImportError:
|
|
13
|
-
import mock
|
|
14
|
-
|
|
15
|
-
import six.moves.builtins as builtins
|
|
11
|
+
from unittest import mock
|
|
16
12
|
|
|
17
13
|
path = os.path.dirname(__file__)
|
|
18
14
|
os.chdir(path)
|
|
@@ -268,7 +264,7 @@ def test_build_issue_96_fail_build_faidx(remove_index):
|
|
|
268
264
|
opened_files.append(f)
|
|
269
265
|
return f
|
|
270
266
|
|
|
271
|
-
with mock.patch('
|
|
267
|
+
with mock.patch('builtins.open', side_effect=test_open):
|
|
272
268
|
try:
|
|
273
269
|
Faidx(fasta_path)
|
|
274
270
|
remove_index.assertFail(
|
|
@@ -305,7 +301,7 @@ def test_build_issue_96_fail_read_malformed_index_duplicate_key(remove_index):
|
|
|
305
301
|
opened_files.append(f)
|
|
306
302
|
return f
|
|
307
303
|
|
|
308
|
-
with mock.patch('
|
|
304
|
+
with mock.patch('builtins.open', side_effect=test_open):
|
|
309
305
|
try:
|
|
310
306
|
Faidx(fasta_path)
|
|
311
307
|
remove_index.assertFail(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|