Commit 1716aa69 authored by Roman Sarrazin-Gendron's avatar Roman Sarrazin-Gendron
Browse files

finished update with textbook chapter release

parent b06ef6f4
......@@ -24,7 +24,7 @@ def get_consensus(module_seqs):
consensus.append([x/tot for x in scores])
return consensus
def rfam_to_module(positions, family_file,output_name, as_list=False, seqs=[]):
def rfam_to_module(positions=[], family_file="",output_name="module_seqs.fasta", as_list=False, seqs=[]):
alph = ["A","C","G","U"]
......@@ -43,6 +43,7 @@ def rfam_to_module(positions, family_file,output_name, as_list=False, seqs=[]):
if str(s[col]) != "-":
this_mod = this_mod + str(s[col])
else:
#print("CONSENSUS:", cons, "CURRENT COLUMN", col)
this_mod = this_mod + alph[choice(np.array([0,1,2,3]),p=cons[col])]
fmodule_seqs.append(this_mod)
......
......@@ -29,14 +29,39 @@ def number_of_strands(nodelist):
return (n_breaks+1)
def match_pos(input_pos,module_pos):
if len(input_pos)==0:
return True
if len(input_pos)==0:
return True
for i in input_pos:
if i in module_pos:
return True
return False
def get_carnaval_graph(file):
n = []
e = []
with open(file) as f:
g = nx.DiGraph()
lines = f.readlines()
for line in lines:
if "+++" in line:
continue
else:
n1,nuc1,bp, n2, nuc2 = line.replace("\n","").split(" ")
if (int(n1),{"nuc": nuc1 }) not in n:
n.append((int(n1),{"nuc": nuc1 }))
if (int(n2),{"nuc": nuc2 }) not in n:
n.append((int(n2),{"nuc": nuc2 }))
if (int(n1),int(n2),{"label" : bp}) not in e:
e.append((int(n1),int(n2),{"label" : bp}))
n = sorted(n)
e = sorted(e)
g.add_nodes_from(n)
g.add_edges_from(e)
return g
for i in input_pos:
if i in module_pos:
return True
return False
def parse_dataset_for_modules(dataset,source_PDBs, n_strands=-1,bp=["None"],input_positions=[]):
modules_in_PDB = []
full_ids = []
......
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