Commit c853871a authored by Yixiong Sun's avatar Yixiong Sun
Browse files

Updated validation code

parent b165d07e
......@@ -409,31 +409,6 @@ def call_makeBN(mod, dataset, module_data, Lambda=1, Theta=1,retrain=False):
# Temporary placeholder function for CV for building a Bayesian Network
def make_BN(module, dataset, graphs, motif_sequences, Lambda=0.35, Theta=1):
# Test sequences should be tuple of seq and positions, seems like it is outdated/not used
test_seqs = []
# Build the BN with the motif sequences
g = graphs[module][0]
aln = {}
for n in sorted(list(g.nodes())):
aln[n] = n
alignment = get_alignment(g, aln, motif_sequences)
motif = make_graph_from_carnaval(g, alignment)
pwm = BN_builder.build_pwm(sorted(list(motif.nodes())), alignment)
BN = BN_builder.build_BN(motif, pwm, alignment)
# PDBs array is also empty, outdated?
BN.from_alignment_dataset(dataset, module, [g], alignment, test_seqs, [], Lambda, Theta)
return BN
if __name__ == "__main__":
......@@ -275,13 +275,13 @@ def create_module(desc, fasta, model_name, list_of_nodes, PDBs=[], pdb_info_file
pdb_aln = []
pdb_seq = []
# Try to load PDB_info
if os.path.isfile(pdb_info_file):
if pdb_info_file is not None and os.path.isfile(pdb_info_file):
with open(pdb_info_file, 'rb') as f:
pdb_aln, pdb_seq = pickle.load(f)
# try to load full_seq_file
full_records = []
if os.path.isfile(full_seq_file):
if full_seq_file is not None and os.path.isfile(full_seq_file):
full_records = list(SeqIO.parse(full_seq_file, "fasta"))
# module signatures from list of nodes
This diff is collapsed.
Markdown is supported
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