Commit 4758d8d8 authored by Roman SARRAZIN GENDRON's avatar Roman SARRAZIN GENDRON
Browse files

small updates to makeBN

parent 7a92fd09
......@@ -45,12 +45,21 @@ def get_pdb_seqs(pdb_list):
def filter_extra_seqs(seqs):
good_seqs = []
for seq in seqs:
if "-" not in seq:
good_seqs.append(seq)
if len(seq)<3:
continue
seq = "".join(seq)
if "\n" in seq:
seq = seq.replace("\n","")
if "-" in seq:
seq = seq.replace("-","")
good_seqs.append(seq)
return good_seqs
def get_alignment(g,aln,extra_seqs):
acceptable_extra_seqs = filter_extra_seqs(extra_seqs)
#print("processed_extra seqs",acceptable_extra_seqs)
aln_dict = od()
nodes = aln.keys()
snodes = sorted(nodes)
......@@ -231,7 +240,12 @@ def call_makeBN(mod,dataset,left_out, leave_out_seq = False, left_out_seq = "",
current_ID = mod
excluded = left_out
g_list = pickle.load(open("../models/"+dataset + "_one_of_each_graph.cPickle",'rb'))
motif_seqs = pickle.load(open("../models/"+dataset + "_sequences.pickle",'rb'))[0][mod]
seq_list = pickle.load(open("../models/"+dataset + "_sequences.pickle",'rb'))
try:
motif_seqs = seq_list[0][mod]
except:
motif_seqs = seq_list[mod]
#print("SEQUENCES",motif_seqs)
extra_seqs=[]
test_seqs = []
g = g_list[current_ID][0]
......@@ -270,8 +284,11 @@ def call_makeBN(mod,dataset,left_out, leave_out_seq = False, left_out_seq = "",
print("Excluded is not none",excluded)
if len(indexes)<2:
indexes = list(range(len(g_list)))
try:
test_seqs = pickle.load(open("../models/"+dataset + "_sequences.pickle",'rb'))[1][mod]
except:
test_seqs = []
test_seqs = pickle.load(open("../models/"+dataset + "_sequences.pickle",'rb'))[1][mod]
if kfold==True:
excluded_indexes = []
left_out_index = indexes.index(excluded)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment