Skip to content
Snippets Groups Projects
Commit f2260105 authored by cmaffeo2's avatar cmaffeo2
Browse files

Added test to check that model_from_basepair_stack_3prime works with circular...

Added test to check that model_from_basepair_stack_3prime works with circular ssDNA; removed warnings and made function work with lists instead of numpy arrays
parent e64fadf3
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ def _primes_list_to_strands(three_prime, five_prime):
strand_is_circular.append(False)
while True:
print("WARNING: working on circular strand {}".format(len(strands)))
## print("WARNING: working on circular strand {}".format(len(strands)))
ids = np.where(idx_to_strand < 0)[0]
if len(ids) == 0: break
build_strand(ids[0],
......@@ -232,6 +232,8 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
basepair,three_prime = [np.array(a,dtype=np.int) for a in inputs]
except:
raise TypeError("One or more of the input lists could not be converted into a numpy array")
inputs = (basepair,three_prime)
coordinate = np.array(coordinate)
if np.any( [len(a.shape) > 1 for a in inputs] ):
raise ValueError("One or more of the input lists has the wrong dimensionality")
......@@ -248,6 +250,7 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
raise ValueError("The 'sequence' parameter is the wrong length {} != {}".format(len(sequence),num_nt))
if orientation is not None:
orientation = np.array(orientation)
if len(orientation.shape) != 3:
raise ValueError("The 'orientation' array has the wrong dimensionality (should be Nx3x3)")
if orientation.shape != (num_nt,3,3):
......@@ -291,8 +294,6 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
for s,c in zip(strands, strand_is_circular):
ss_residues = s[np.where(hmap[s] < 0)[0]]
if len(ss_residues) == 0: continue
if c:
print("WARNING: Circular ssDNA strands may not be modeled correctly")
resid_diff = np.diff(ss_residues)
tmp = np.where( resid_diff != 1 )[0]
......@@ -403,3 +404,20 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
s.randomize_unset_sequence()
return model
def UNIT_circular():
""" Make a circular DNA strand, with dsDNA in the middle """
coordinate = [(0,0,3.4*i) for i in range(7)]
stack = -1*np.ones(len(coordinate))
three_prime = [ 1, 2, 4,-1, 6, 3, 0]
basepair = [-1,-1, 3, 2, 5, 4,-1]
stack = [-1,-1, 4,-1,-1, 3,-1]
for i in [3,5]:
coordinate[i] = (1,0,3.4*i)
model = model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
max_basepairs_per_bead=1,
max_nucleotides_per_bead=1,
local_twist=True)
model.simulate(output_name='circular', directory='unittest')
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