-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Summary
Thus far, I have always been a little confused to the units of our DNAedge
objects. Having started to review code I implemented over the summer, I have found a few errors, although they are easily fixed.
I would like to update this base class. But would first like to check with you @debeshmandal that it won't break any code you/chris/fiona are working on.
e.g. if node1=[0,0,0]
node2=[5,0,0]
i would like to make updates such that the following would be true
DNAEdge.length=6
the length of edge in the number of nucleotidesDNAEdge.nt_length=5*2.45
the distance from the first nucleotide to last nucleotide in oxDNA units
Details
Essentially, when generating DNA strands between the DNANodes
of a LatticeRoute
, the edge lengths are already in terms of the number of nucleotides. When we generate the strands, we are setting the number of nucleotides, n
to the nt_length
of the edge. This takes the length of the edge and multiplies it by 2.45 (oxDNA distance between two nucleotides) and hence it gives the distance in oxDNA units. Instead, what we should be doing is setting the number of nucleotides, n
, to the corresponding length
of a DNAEdge
.
Also, if DNAedge.length
is supposedly in units of nucleotides, it has been calculated wrong (see updated version below)
Currently
Code extract from route.py -> update_strands()
...
# generate strand above that's going in opposite direction
strand = generate_helix(n=int(self.edges[i].nt_length),
start_position=start,
direction=direction,
a1=a1)[0]
strands.append(strand)
...
tools.py -> DNAEdge()
@property
def length(self):
"""The length of the edge in oxdna units (i think)"""
return np.linalg.norm(self.vector)
@property
def nt_length(self):
"""The length of the edge in units of nucleotides"""
return int(self.length * 2.45)
Updated code:
route.py -> update_strands()
...
# generate strand above that's going in opposite direction
strand = generate_helix(n=int(self.edges[i].length),
start_position=start,
tools.py -> DNAEdge()
@property
def length(self):
"""The length of the edge in units of nucleotides"""
return int(np.linalg.norm(self.vector)+1)
@property
def nt_length(self):
"""The distance from the first nucleotide to last nucleotide in oxDNA units"""
return int((self.length-1) * 2.45)