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

add

parent 6c543c98
No related branches found
No related tags found
1 merge request!1Pinyili2
......@@ -37,10 +37,10 @@ def read_list(infile,**model_parameters):
return model_from_basepair_stack_3prime(coords, bp, stack, three_prime)
def read_pandas(df,coordinate_col="r",bp_col="bp",stack_col="stack",three_prime_col="threeprime",
seq_col=None,orientation_col=None):
seq_col="seq",orientation_col="orientation"):
from .segmentmodel_from_lists import model_from_pandas
return model_from_pandas(df,coordinate_col,bp_col,stack_col,three_prime_col,
seq_col,orientation_col),
seq_col,orientation_col)
def read_atomic_pdb(pdb_file, **model_parameters):
from .segmentmodel_from_pdb import SegmentModelFromPdb
......
......@@ -477,45 +477,39 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime,
return model
def model_from_pandas(df,coordinate_col="r",bp_col="bp",stack_col="stack",three_prime_col="threeprime",
seq_col=None,orientation_col=None,
seq_col="seq",orientation_col="orientation",
max_basepairs_per_bead = 5,
max_nucleotides_per_bead = 5,
local_twist = False,
dimensions=(5000,5000,5000)
,**model_parameters):
try:
c=df[coordinate_col]
c=np.array(list(df[coordinate_col]))
except:
print("cannot locate coordinate")
try:
bp=df[bp_col]
bp=np.array(df[bp_col])
except:
print("cannot locate bp")
try:
stack=df[stack_col]
stack=np.array(df[stack_col])
except:
print("cannot find stack")
try:
tprime=df[three_prime_col]
tprime=np.array(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:
try:
seq=np.array(df[seq_col])
except:
print("no sequence inputted")
seq=None
if orientation_col is not None:
try:
orient=df[orientation_col]
except:
print("no orientation inputted")
orient=None
else:
orient=None
try:
orient=np.array(list(df[orientation_col]))
except:
print("no orientation inputted")
orient=None
try:
model=model_from_basepair_stack_3prime(c, bp, stack, tprime,
......@@ -525,6 +519,8 @@ def model_from_pandas(df,coordinate_col="r",bp_col="bp",stack_col="stack",three_
local_twist = local_twist,
dimensions=dimensions,
**model_parameters)
model._dataframe=df
return model
except:
print("cannot phrase DataFrame, aborted")
......
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