mirror of
https://github.com/Lukas0025/POC1-SIMD-DNA.git
synced 2025-04-05 07:11:32 +01:00
Fixed chain unwrap only when free base and replace
This commit is contained in:
parent
d232355349
commit
9d8ffb7ee6
@ -1,14 +1,10 @@
|
||||
#
|
||||
# 1 2 3 4 5 6 7 8
|
||||
# A B C D E F G H
|
||||
#
|
||||
|
||||
define:
|
||||
0 [ABC][DE]
|
||||
1 [AB][CDE]
|
||||
|
||||
data:
|
||||
1011{FT} # {FT} is TUE BINDING hold
|
||||
# {F} is TUE BINDING hold
|
||||
1011{F}
|
||||
|
||||
instructions:
|
||||
# mark last if is 1 if exist and replace this and open base C
|
||||
@ -21,19 +17,19 @@ instructions:
|
||||
#
|
||||
# if next bit is 1 it again replace this and open base C this is chain reaction
|
||||
#
|
||||
{D*E*F*T*G*} {D*E*A*B*C*H*}
|
||||
{D*E*F*G*} {D*E*A*B*C*H*}
|
||||
|
||||
# remove all markers
|
||||
{DEFTG} {DEABCH}
|
||||
{DEFG} {DEABCH}
|
||||
|
||||
# set 1 end this unvrap last 0
|
||||
{C*D*E*}
|
||||
|
||||
# shift 1 end to center of register cell if possible to by eble of unvrap by 0
|
||||
# shift 1 end to center of register cell if possible. This allow unvrap by 0
|
||||
{B*C*D*}
|
||||
|
||||
# set 0
|
||||
{ABC} {DE}
|
||||
{A*B*C*} {D*E*}
|
||||
|
||||
# remove last 0
|
||||
{ABC}
|
||||
|
@ -9,6 +9,6 @@ instructions:
|
||||
{D*E*A*F*} # mark 01
|
||||
{D*E*A*B*C*G*} # mark 11
|
||||
{DEABCG} # remove mark 11
|
||||
{A*B*C*}{D*E*} # write 0
|
||||
{A*B*C*} {D*E*} # write 0
|
||||
{DEAF} # remove mark 01
|
||||
{B*C*D*E*} # write 1
|
@ -53,7 +53,7 @@ class Register:
|
||||
for mol in IMols:
|
||||
# remove all unstable binded chains binded on 1 base or lower
|
||||
self.removeUnstable()
|
||||
|
||||
|
||||
##
|
||||
# remove unbinded chains from register (because new imol have bind on more posisin on register that older)
|
||||
# --
|
||||
@ -61,6 +61,7 @@ class Register:
|
||||
# ---
|
||||
# |||
|
||||
# ---- R
|
||||
#
|
||||
def removeReplaced(self):
|
||||
while True:
|
||||
done = True
|
||||
@ -91,6 +92,7 @@ class Register:
|
||||
# ---
|
||||
#
|
||||
# ---- R
|
||||
#
|
||||
def removeUnbinded(self):
|
||||
while True:
|
||||
done = True
|
||||
@ -104,7 +106,8 @@ class Register:
|
||||
if not(self.mol.getBase(chainIB, pos) == molecule.nothing and self.mol.getBase(chainIA, pos) == molecule.nothing):
|
||||
bindScore -= 1
|
||||
|
||||
if bindScore == 0:
|
||||
# chack if strand have any free binding base to strap it
|
||||
if bindScore == 0 and self.haveChainFreeBaseFor(chainIA, chainIB) and self.haveChainFreeBaseFor(chainIB, chainIA):
|
||||
self.mol.removeChain(max(chainIA, chainIB))
|
||||
self.mol.removeChain(min(chainIA, chainIB))
|
||||
done = False
|
||||
@ -123,7 +126,7 @@ class Register:
|
||||
done = True
|
||||
# for all chains in register
|
||||
# primary detach newer
|
||||
for chainI in range(self.mol.chainsCount() - 1, 0, -1):
|
||||
for chainI in range(1, self.mol.chainsCount()):
|
||||
# for all bases in molecule
|
||||
bindScore = 0
|
||||
finalBindScore = 0
|
||||
@ -143,6 +146,16 @@ class Register:
|
||||
if done:
|
||||
break
|
||||
|
||||
def haveChainFreeBaseFor(self, chainA, chainB):
|
||||
for baseID in range(len(self.mol)):
|
||||
if molecule.isComplementary(self.mol.getBase(chainA, baseID), self.mol.getBase(chainB, baseID)):
|
||||
if not molecule.isComplementary(self.mol.getBase(chainA, baseID), self.mol.getBase(0, baseID)):
|
||||
return True
|
||||
elif self.mol.bindedCountAt(baseID) >= 2:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
##
|
||||
# try bind mol to all possible bindings
|
||||
# Added all imol bindings as new chains
|
||||
|
Loading…
x
Reference in New Issue
Block a user