Exemplo n.º 1
0
import MHC_test as MHC
from N_W import alignment
from Bio.SubsMat import MatrixInfo as mi
from Bio.pairwise2 import format_alignment
from Bio import pairwise2
from datetime import datetime
matrix = mi.blosum62
go = -1
ge = -1
print("afinic_gap", "simple_cost_function")
start_time = datetime.now()
pairwise2.align.globalxs(MHC.Homo_sapiens, MHC.Mus_musculus, -2, -1)
time_elapsed = datetime.now() - start_time
print('biopython', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))
start_time = datetime.now()
X = alignment([MHC.Homo_sapiens, MHC.Mus_musculus],
              go,
              ge, [1, 0],
              ret_max=2,
              local=False,
              linear_memory=False)
time_elapsed = datetime.now() - start_time
print('our implemation', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))

for a in pairwise2.align.globalxs(MHC.Homo_sapiens, MHC.Mus_musculus, -2, -1):
    print(format_alignment(*a))
    break
print(X)
Exemplo n.º 2
0
matrix = mi.blosum62

str1 = "AAAABBBBCCCCMMMMAAABBBWWW"
str2 = "AAAABZAABCPANMMMAAABBBWWW"
import time

start_time = datetime.now()
start_time = time.time()
print("Iteration test for afinic gap algorytm")
x = "%s" % (time.time() - start_time)
next_iter = 1
while (next_iter):
    start_time = time.time()
    go = -1
    ge = -1
    alignment([str1, str2], go, ge, matrix, ret_max=1, linear_memory=False)
    x = "%s" % (time.time() - start_time)
    x = float(x)
    print("time taken", x)
    print(len(str1), len(str2))
    next_iter = input("Do you want to try next iteration")
    if (x > 10):
        break
    str1 = str2 + str1
    str2 = str1 + str2
"""
output
Iteration test for afinic gap algorytm
time taken 0.0
25 25
Exemplo n.º 3
0
import MHC_test as MHC
from N_W import alignment
from Bio.SubsMat import MatrixInfo as mi
from Bio.pairwise2 import format_alignment
from Bio import pairwise2
from datetime import datetime

matrix = mi.blosum62
go = 0
ge = -1
print("multiseq", "simple_cost_function")
start_time = datetime.now()
X = alignment([
    MHC.Homo_sapiens[0:40], MHC.Mus_musculus[0:40], MHC.Rattus_norvegicus[0:40]
],
              go,
              ge, [1, 0],
              ret_max=2,
              local=False,
              linear_memory=False)
time_elapsed = datetime.now() - start_time
print('our implemation', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))

print(X)
Exemplo n.º 4
0
import MHC_test as MHC
from N_W import alignment
from Bio.SubsMat import MatrixInfo as mi
from Bio.pairwise2 import format_alignment
from Bio import pairwise2
from datetime import datetime
matrix = mi.blosum62
go = 0
ge = -1
print("afinic_local_gap")
start_time = datetime.now()
pairwise2.align.globalds(MHC.Mus_musculus, MHC.Mus_musculus, matrix, -1, -1)
time_elapsed = datetime.now() - start_time
print('biopython', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))
start_time = datetime.now()
X = alignment([MHC.Mus_musculus, MHC.Mus_musculus],
              go,
              ge,
              matrix,
              ret_max=2,
              local=False,
              linear_memory=True)
time_elapsed = datetime.now() - start_time
print('our implemation', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))

for a in pairwise2.align.globalds(MHC.Mus_musculus, MHC.Mus_musculus, matrix,
                                  -1, -1):
    print(format_alignment(*a))
print(X)
Exemplo n.º 5
0
import MHC_test as MHC
from N_W import alignment
from Bio.SubsMat import MatrixInfo as mi
from Bio.pairwise2 import format_alignment
from Bio import pairwise2
from datetime import datetime 
matrix = mi.blosum62
go= -1
ge= -1
print("afinic_local_gap") 
start_time = datetime.now() 
pairwise2.align.localds(MHC.Rattus_norvegicus[:100], MHC.Pan_troglodytes[:100], matrix,-2,-1)
time_elapsed = datetime.now() - start_time 
print('biopython','Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))
start_time = datetime.now() 
X=alignment([MHC.Rattus_norvegicus[:100], MHC.Pan_troglodytes[:100]],go,ge,matrix,ret_max = 20,local = True)
time_elapsed = datetime.now() - start_time 
print('our implemation','Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))

for a in pairwise2.align.localds(MHC.Rattus_norvegicus[:100], MHC.Pan_troglodytes[:100], matrix,-2,-1):
    print(format_alignment(*a))
print(X)
Exemplo n.º 6
0
import MHC_test as MHC
from N_W import alignment
from Bio.SubsMat import MatrixInfo as mi
from Bio.pairwise2 import format_alignment
from Bio import pairwise2
from datetime import datetime
matrix = mi.blosum62
go = -1
ge = -1
print("afinic_gap")
start_time = datetime.now()
pairwise2.align.globalds(MHC.Homo_sapiens, MHC.Pan_troglodytes, matrix, -2, -1)
time_elapsed = datetime.now() - start_time
print('biopython', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))
start_time = datetime.now()
X = alignment([MHC.Homo_sapiens, MHC.Pan_troglodytes],
              go,
              ge,
              matrix,
              ret_max=20)
time_elapsed = datetime.now() - start_time
print('our implemation', 'Time elapsed (hh:mm:ss.ms) {}'.format(time_elapsed))

for a in pairwise2.align.globalds(MHC.Homo_sapiens, MHC.Pan_troglodytes,
                                  matrix, -2, -1):
    print(format_alignment(*a))
print(X)
Exemplo n.º 7
0
from Bio.SubsMat import MatrixInfo as mi
from Bio.pairwise2 import format_alignment
import time
from datetime import datetime 
s=mi.blosum62


#X=alignment([MHC.Homo_sapiens,MHC.Pan_troglodytes],go,ge,s,ret_max = 1)
#print(X)
from Bio import pairwise2
#Bio python documentation example comparing
alignments = pairwise2.align.globalxx("ACCGT", "ACG")
print(format_alignment(*alignments[0]))
go=0
ge=0
X=alignment(["ACCGT","ACG"],go,ge,[1,0],ret_max = 1)
print(X)
for a in pairwise2.align.globalmx("ACCGT", "ACG", 2, -1):
    print(format_alignment(*a))
go=0
ge=0
X=alignment(["ACCGT","ACG"],go,ge,[2,-1],ret_max = 20)
print(X)

for a in pairwise2.align.globalms("ACCGT", "ACG", 2, -1, -.5, -.1):
    print(format_alignment(*a))

go= -.4
ge= -.1    
X=alignment(["ACCGT","ACG"],go,ge,[2,-1],ret_max = 20)
print(X)