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