Skip to content
Snippets Groups Projects
Commit 044a63a0 authored by pinyili2's avatar pinyili2
Browse files

add code

parent 536fadcc
No related branches found
No related tags found
1 merge request!1Pinyili2
...@@ -234,7 +234,7 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime, ...@@ -234,7 +234,7 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
max_basepairs_per_bead = 5, max_basepairs_per_bead = 5,
max_nucleotides_per_bead = 5, max_nucleotides_per_bead = 5,
local_twist = False, local_twist = False,
dimensions=(5000,5000,5000),return_prop=False dimensions=(5000,5000,5000)
**model_parameters): **model_parameters):
""" """
Creates a SegmentModel object from lists of each nucleotide's Creates a SegmentModel object from lists of each nucleotide's
...@@ -475,11 +475,62 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime, ...@@ -475,11 +475,62 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
if sequence is None: if sequence is None:
for s in model.segments: for s in model.segments:
s.randomize_unset_sequence() s.randomize_unset_sequence()
if return_prop is True:
nt_prop=pd.DataFrame({"r":coordinate,"bp":basepair,"stack":stack,"fwd":fwd,"threeprime":three_prime,"seq":sequence,"orientation":orientation}) return model
return model,nt_prop
def model_from_pandas(df,coordinate_col="r",bp_col="bp",stack_col="stack",three_prime_col="threeprime",
seq_col=None,orientation_col=None,
max_basepairs_per_bead = 5,
max_nucleotides_per_bead = 5,
local_twist = False,
dimensions=(5000,5000,5000)
**model_parameters):
try:
c=df[coordinate_col]
except:
print("cannot locate coordinate")
try:
bp=df[bp_col]
except:
print("cannot locate bp")
try:
stack=df[stack_col]
except:
print("cannot find stack")
try:
tprime=df[three_prime_col]
except:
print("cannot locate 3's")
if seq_col is not None:
try:
seq=df[seq_col]
except:
print("no sequence inputted")
seq=None
else: else:
seq=None
if orientation_col is not None:
try:
orient=df[orientation_col]
except:
print("no orientation inputted")
orient=None
else:
orient=None
try:
model=model_from_basepair_stack_3prime(c, bp, stack, tprime,
sequence=seq, orientation=orient,
max_basepairs_per_bead = max_basepairs_per_bead,
max_nucleotides_per_bead =max_nucleotides_per_bead ,
local_twist = local_twist,
dimensions=dimensions
**model_parameters)
model._dataframe=df
return model return model
except:
print("cannot phrase DataFrame, aborted")
def UNIT_circular(): def UNIT_circular():
""" Make a circular DNA strand, with dsDNA in the middle """ """ Make a circular DNA strand, with dsDNA in the middle """
......
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