Skip to content
Snippets Groups Projects
Verified Commit c5ffa34a authored by Etienne MORICE's avatar Etienne MORICE
Browse files

Changed dtype to int32 and added plot

parent 5e447d8a
No related branches found
No related tags found
No related merge requests found
......@@ -3,3 +3,4 @@ balibase/
__pycache__/
balibase.zip
atlas
timings.png
......@@ -11,3 +11,6 @@ test:
test_performance:
script:
- python3 -m unittest alignementseq_tests.PerformanceTestCase
artifacts:
paths:
- timings.png
......@@ -159,7 +159,7 @@ def vec_align(seq1, seq2, mat=dict_to_weight(Bio.SubsMat.MatrixInfo.blosum62), g
x = np.array(list(ord(c)-ord('A') for c in seq1.seq))
y = np.array(list(ord(c)-ord('A') for c in seq2.seq))
mat = mat.flatten()
S = [ np.zeros(min(s,n,m,n+m-s)+1, dtype=np.int) for s in range(n+m+1) ]
S = [ np.zeros(min(s,n,m,n+m-s)+1, dtype=np.int32) for s in range(n+m+1) ]
S[0][0] = 0
S[1][0] = gap
......
......@@ -8,6 +8,7 @@ import warnings
import timeit
import multiprocessing
import pandas as pd
import matplotlib.pyplot
import Bio.SeqIO
import Bio.pairwise2
......@@ -144,7 +145,8 @@ class PerformanceTestCase(AlignmentSeqTestCase):
from alignementseq import align, vec_align
methods = (vec_align, align)
times = pd.DataFrame(columns=("length1", "length2", "method", "time"))
times = pd.DataFrame(columns=("length1", "length2", "method", "time"),
dtype=float)
for s1, s2, filename in self.get_dataset_heads():
for method in methods:
def to_time():
......@@ -153,7 +155,17 @@ class PerformanceTestCase(AlignmentSeqTestCase):
times.loc[len(times)] = (
len(s1.seq), len(s2.seq), method.__name__, t
)
times['length_product'] = times.length1 * times.length2
print(times)
ax = None
cmap = matplotlib.cm.inferno
colors = [ cmap(i/2) for i in range(2) ]
for im, method in enumerate(methods):
ax = times.loc[times.method == method.__name__].plot.scatter(
'length_product', 'time', c=colors[im],
label=method.__name__, ax=ax)
matplotlib.pyplot.savefig("timings.png")
def test_titin(self):
from alignementseq import align, vec_align
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment