From ffbe85f0901d0aa25010f2a54e95b45413909190 Mon Sep 17 00:00:00 2001 From: pinyili2 <pinyili2@illinois.edu> Date: Sat, 17 Aug 2024 11:21:34 -0500 Subject: [PATCH] update init --- mrdna/readers/__init__.py | 11 ++++++++--- mrdna/readers/segmentmodel_from_cadnano.py | 1 - mrdna/readers/segmentmodel_from_lists.py | 7 ++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mrdna/readers/__init__.py b/mrdna/readers/__init__.py index 33b2a79..1b61d77 100644 --- a/mrdna/readers/__init__.py +++ b/mrdna/readers/__init__.py @@ -33,12 +33,17 @@ def read_list(infile,**model_parameters): from .segmentmodel_from_lists import model_from_basepair_stack_3prime 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): + 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), def read_atomic_pdb(pdb_file, **model_parameters): from .segmentmodel_from_pdb import SegmentModelFromPdb return SegmentModelFromPdb(pdb_file) -def read_oxdna(coordinate_file, topology_file, idealized_coordinate_file=None, **model_parameters): +def read_oxdna(coordinate_file, topology_file, virt2nuc=None, **model_parameters): """ Idealized coordinate file: coordinates for detecting stacks and base pairs, defaults to coordinate_file """ - from .segmentmodel_from_oxdna import mrdna_model_from_oxdna - return mrdna_model_from_oxdna(coordinate_file, topology_file, idealized_coordinate_file, **model_parameters) + from .segmentmodel_from_oxdna_pinyi import mrdna_model_from_oxdna + return mrdna_model_from_oxdna(coordinate_file, topology_file,virt2nuc, **model_parameters) diff --git a/mrdna/readers/segmentmodel_from_cadnano.py b/mrdna/readers/segmentmodel_from_cadnano.py index 7021722..f8127e7 100644 --- a/mrdna/readers/segmentmodel_from_cadnano.py +++ b/mrdna/readers/segmentmodel_from_cadnano.py @@ -222,5 +222,4 @@ def mrdna_model_from_cadnano(json_file,seq=None,**model_parameters): stack=np.array((list(nt_prop["stack"]))) orientation=np.array(list(nt_prop["orientation"])) model = model_from_basepair_stack_3prime( r, bp, stack, three_prime, seq, orientation, **model_parameters ) - model._dataframe=nt_prop return model diff --git a/mrdna/readers/segmentmodel_from_lists.py b/mrdna/readers/segmentmodel_from_lists.py index 922b3d2..3f96df7 100644 --- a/mrdna/readers/segmentmodel_from_lists.py +++ b/mrdna/readers/segmentmodel_from_lists.py @@ -230,7 +230,7 @@ def set_splines(seg, coordinate, hid, hmap, hrank, fwd, basepair, orientation=No def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime, - sequence=None, orientation=None, + sequence=None, orientation=None, max_basepairs_per_bead = 5, max_nucleotides_per_bead = 5, local_twist = False, @@ -471,10 +471,12 @@ def model_from_basepair_stack_3prime(coordinate, basepair, stack, three_prime, model._reader_list_hmap = hmap model._reader_list_fwd = fwd model._reader_list_hrank = hrank - + df=pd.DataFrame({"r":coordinate,"bp":basepair,"stack":stack,"threeprime":three_prime,"seq":sequence,"orientation":orientation,"fwd":fwd,"hmap":hmap,"hrank":hrank,}) if sequence is None: for s in model.segments: s.randomize_unset_sequence() + + model._dataframe=df return model @@ -527,7 +529,6 @@ 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") -- GitLab