pyopa 0.9.0__cp315-cp315-win_amd64.whl
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.
- pyopa/__init__.py +21 -0
- pyopa/aligner.py +47 -0
- pyopa/backend/__init__.py +0 -0
- pyopa/backend/cpyopa.pxd +61 -0
- pyopa/backend/pyopa.c +39091 -0
- pyopa/backend/pyopa.cp315-win_amd64.pyd +0 -0
- pyopa/backend/pyopa.pyx +947 -0
- pyopa/matrices/json/all_matrices.json +1 -0
- pyopa/matrices/json/logPAM1.json +1 -0
- pyopa/matrices/json/logPAM1_unscaled.json +448 -0
- pyopa/matrices/jtt.dat +50 -0
- pyopa-0.9.0.dist-info/DELVEWHEEL +2 -0
- pyopa-0.9.0.dist-info/METADATA +68 -0
- pyopa-0.9.0.dist-info/RECORD +18 -0
- pyopa-0.9.0.dist-info/WHEEL +5 -0
- pyopa-0.9.0.dist-info/licenses/LICENSE +373 -0
- pyopa-0.9.0.dist-info/top_level.txt +1 -0
- pyopa.libs/vcomp140-f96f3a14d88d8846f31f3ab38a490304.dll +0 -0
pyopa/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""""" # start delvewheel patch
|
|
2
|
+
def _delvewheel_patch_1_13_2():
|
|
3
|
+
import os
|
|
4
|
+
if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'pyopa.libs'))):
|
|
5
|
+
os.add_dll_directory(libs_dir)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
_delvewheel_patch_1_13_2()
|
|
9
|
+
del _delvewheel_patch_1_13_2
|
|
10
|
+
# end delvewheel patch
|
|
11
|
+
|
|
12
|
+
from .backend.pyopa import *
|
|
13
|
+
from .aligner import Aligner
|
|
14
|
+
|
|
15
|
+
__version__ = "0.9.0"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def version():
|
|
19
|
+
"""returns the current version of pyopa"""
|
|
20
|
+
return __version__
|
|
21
|
+
|
pyopa/aligner.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import bisect
|
|
2
|
+
from . import backend
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Aligner(object):
|
|
6
|
+
def __init__(self, env=None):
|
|
7
|
+
if env is None:
|
|
8
|
+
envs = backend.pyopa.load_default_environments()
|
|
9
|
+
self.environments = envs['environments']
|
|
10
|
+
self.pam1 = envs['log_pam1']
|
|
11
|
+
else:
|
|
12
|
+
raise NotImplementedError("non-default environments are not yet implemented")
|
|
13
|
+
self._pam_distances = [env.pam for env in self.environments]
|
|
14
|
+
|
|
15
|
+
def environment_at_distance(self, dist):
|
|
16
|
+
"""returns the :class:`AlignmentEnvironment` for a given distance.
|
|
17
|
+
|
|
18
|
+
The returned AlignmentEnvironment is optimized for the given
|
|
19
|
+
evolutionary distance, i.e. sequences that diverged for this
|
|
20
|
+
evolutionary distance will reach the highest alignment score
|
|
21
|
+
with this scoring matrix.
|
|
22
|
+
|
|
23
|
+
:param numeric dist: the evolutionary distance"""
|
|
24
|
+
index = bisect.bisect_right(self._pam_distances, dist)
|
|
25
|
+
|
|
26
|
+
if index == len(self._pam_distances):
|
|
27
|
+
return self.environments[index - 1]
|
|
28
|
+
return min(self.environments[index - 1], self.environments[index],
|
|
29
|
+
key=lambda x: abs(x.pam - dist))
|
|
30
|
+
|
|
31
|
+
def score(self, s1, s2, env=None, **kwargs):
|
|
32
|
+
"""Compute the alignment score using Farrer's algorithm.
|
|
33
|
+
|
|
34
|
+
Compute the optimal pairwise alignment score of the two sequences
|
|
35
|
+
`s1` and `s2` for either a fixed scoring environment, or compute
|
|
36
|
+
the overall best score
|
|
37
|
+
"""
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
def align(self, s1, s2, env=None, **kwargs):
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
def estimate_distance(self, s1, s2):
|
|
44
|
+
"""Estimates the evolutionary distance for a fixed alignment.
|
|
45
|
+
|
|
46
|
+
This method requires already aligned sequences `s1` and `s2`. """
|
|
47
|
+
pass
|
|
File without changes
|
pyopa/backend/cpyopa.pxd
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
cdef extern from "Python_extension.h":
|
|
2
|
+
ctypedef struct ProfileByte:
|
|
3
|
+
pass
|
|
4
|
+
ctypedef struct ProfileShort:
|
|
5
|
+
pass
|
|
6
|
+
|
|
7
|
+
double c_align_scalar_reference_local(double* matrix, const char *s1, int ls1, const char *s2, int ls2,
|
|
8
|
+
double gap_open, double gap_ext, double threshold)
|
|
9
|
+
double c_align_profile_byte_sse_local(ProfileByte* profile, const char *s2, int ls2,
|
|
10
|
+
double gap_open, double gap_ext, double threshold)
|
|
11
|
+
double c_align_profile_short_sse_local(ProfileShort* profile, const char *s2, int ls2,
|
|
12
|
+
double gap_open, double gap_ext, double threshold)
|
|
13
|
+
|
|
14
|
+
ProfileByte* c_create_profile_byte_sse_local(const char* query, int query_len, signed char* matrix)
|
|
15
|
+
ProfileShort* c_create_profile_short_sse_local(const char* query, int query_len, signed short* matrix)
|
|
16
|
+
|
|
17
|
+
void c_free_profile_byte_sse_local(ProfileByte* profile)
|
|
18
|
+
void c_free_profile_short_sse_local(ProfileShort* profile)
|
|
19
|
+
|
|
20
|
+
double c_align_double_local(double* matrix, const char *s1, int ls1, const char *s2, int ls2, double gap_open,
|
|
21
|
+
double gap_ext, double threshold, int* max1, int* max2)
|
|
22
|
+
double c_align_double_global(double* matrix, const char *s1, int ls1, const char *s2, int ls2,
|
|
23
|
+
double gap_open, double gap_ext)
|
|
24
|
+
int c_align_strings(double* matrix, char *s1, int len1, char *s2, int len2, double escore, char *o1,
|
|
25
|
+
char *o2, double maxerr, double gap_open, double gap_ext)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
cdef extern from "EstimatePam.h":
|
|
29
|
+
ctypedef struct DayMatrix:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
DayMatrix* createDayMatrices(double* gapOpen, double* gapExt,
|
|
33
|
+
double* pamDistances, long long* matrix_pointers, int DMSLen)
|
|
34
|
+
void EstimatePam(char* o1, char* o2, int len, DayMatrix* DMS, int DMSLen,
|
|
35
|
+
double* logPAM1, double* result) nogil
|
|
36
|
+
void freeDayMatrices(DayMatrix* DMS, int DMSLen)
|
|
37
|
+
void CreateOrigDayMatrix(double* log_pam1, double pam, double* new_matrix)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
cdef extern from "EstimatePamEigen.h":
|
|
41
|
+
ctypedef struct PamModel:
|
|
42
|
+
int nlam
|
|
43
|
+
double lam[26]
|
|
44
|
+
double V[676]
|
|
45
|
+
double W[676]
|
|
46
|
+
double L1[676]
|
|
47
|
+
double L2[676]
|
|
48
|
+
double L3[676]
|
|
49
|
+
|
|
50
|
+
void EstimatePamEigen(const char* o1, const char* o2, int len, DayMatrix* DMS, int DMSLen,
|
|
51
|
+
const PamModel* model, double* result) nogil
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
cdef extern from "DynProgr_sse_double.h":
|
|
55
|
+
ctypedef struct ProfileDouble:
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
double align_double_local(ProfileDouble* profileDouble, const char *s2, int ls2, double gap_open,
|
|
59
|
+
double gap_ext, double threshold, int* max1, int* max2)
|
|
60
|
+
ProfileDouble* createProfileDoubleSSE(const char* s1, int ls1, double* matrix)
|
|
61
|
+
void free_profile_double_sse(ProfileDouble* profile)
|