diff --git a/mrdna/readers/segmentmodel_from_cadnano.py b/mrdna/readers/segmentmodel_from_cadnano.py index f6fb139e9b98503c0c7b939d8ce6f05883ea9639..7c6c33c40a9123de0ebec7474479d31289873ad5 100644 --- a/mrdna/readers/segmentmodel_from_cadnano.py +++ b/mrdna/readers/segmentmodel_from_cadnano.py @@ -174,6 +174,19 @@ def gen_prop_table(part): nt_prop.reset_index(inplace=True) nt_prop["seq"]=-1 ind_tuple=list(zip(nt_prop["vh"],nt_prop["zid"],nt_prop["fwd"])) + not_stacked,=np.where(nt_prop["stack_tuple"]==-1) + for i in not_stacked: + zid=int(nt_prop.loc[i]["zid"]) + fwd=nt_prop.loc[i]["fwd"] + if fwd == True: + zid+=1 + else: + zid-=1 + try: + ind_tuple.index((nt_prop.loc[i]["vh"],str(zid),fwd)) + nt_prop["stack_tuple"][i]=(nt_prop.loc[i]["vh"],str(zid),fwd) + except: + continue stacks=[] for i in list(nt_prop["stack_tuple"]): if i ==-1: diff --git a/mrdna/readers/segmentmodel_from_oxdna_pinyi.py b/mrdna/readers/segmentmodel_from_oxdna_pinyi.py index fbd418dcf0f70c724b68863797b8e09e25bf907d..b14e94f2a4cc7d0873110ce8750604c2e3165e61 100644 --- a/mrdna/readers/segmentmodel_from_oxdna_pinyi.py +++ b/mrdna/readers/segmentmodel_from_oxdna_pinyi.py @@ -100,6 +100,10 @@ def mrdna_model_from_oxdna(coordinate_file, topology_file,virt2nuc=None,get_nt_p nt_prop["threeprime"]=top_data[2] nt_prop["seq"]=top_data[1] nt_prop["stack"]=top_data[2] + vh_bool=1-(nt_prop["vh"]%2)*2 + is_scaf_bool=nt_prop["is_scaf"]*2-1 + nt_prop["fwd"]=np.array((is_scaf_bool.T*vh_bool+1)/2,dtype=bool) + for i in nt_prop.index: if nt_prop.loc[i]["threeprime"] in nt_prop.index: if nt_prop.loc[nt_prop.loc[i]["threeprime"]]["vh"]!=nt_prop.loc[i]["vh"]: @@ -114,9 +118,10 @@ def mrdna_model_from_oxdna(coordinate_file, topology_file,virt2nuc=None,get_nt_p pass counter+=1 nt_prop["bp"]=bp - vh_bool=1-(nt_prop["vh"]%2)*2 - is_scaf_bool=nt_prop["is_scaf"]*2-1 - nt_prop["fwd"]=np.array((is_scaf_bool.T*vh_bool+1)/2,dtype=bool) + + non_stack_ind,=np.where(nt_prop["stack"]==-1) + for i in non_stack_ind: + zid=nt_prop return nt_prop try: nt_prop=get_virt2nuc(virt2nuc,top_data)