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

added -interm option

parent bf65c555
......@@ -116,6 +116,11 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
else:
o = "output"
if "interm" in arguments:
interm = True
else:
interm = False
if "sscons" in arguments:
sscons = arguments["sscons"]
else:
......@@ -136,6 +141,8 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
if len(seq) <= 200:
#print("Running BayesPairing on full sequence")
maxs = run_BP(seq, ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k)
if interm:
print('PURE SEQUENCE RESULTS:',maxs)
all_maxes = []
for ind, mod in enumerate(modules_to_parse):
all_maxes.append([mod, *maxs[ind]])
......@@ -148,6 +155,8 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
#print("Running BayesPairing on sequence window:", index, index + w)
bf = max(0, index)
maxs = run_BP(seq[index:index + w], ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k)
if interm:
print('PURE SEQUENCE RESULTS:',maxs)
for mod in modules_to_parse:
corrected_maxes = []
for ind, cand in enumerate(maxs[modules_to_parse.index(mod)]):
......@@ -159,6 +168,8 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
index = index + s
#print("Running BayesPairing on sequence window:", index, len(seq))
maxs = run_BP(seq[index:], ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k)
if interm:
print('PURE SEQUENCE RESULTS:',maxs)
for mod in modules_to_parse:
corrected_maxes = []
for ind, cand in enumerate(maxs[modules_to_parse.index(mod)]):
......@@ -193,6 +204,8 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
if len(seq) <= 200:
#print("Running BayesPairing on full sequence")
maxs = run_BP(seq, ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k,sscons)
if interm:
print('PURE SEQUENCE RESULTS:',maxs)
all_maxes = []
for ind, mod in enumerate(modules_to_parse):
all_maxes.append([mod, *maxs[ind]])
......@@ -205,6 +218,8 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
#print("Running BayesPairing on sequence window:", index, index + w)
bf = max(0, index)
maxs = run_BP(seq[index:index + w], ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k,sscons)
if interm:
print('PURE SEQUENCE RESULTS:',maxs)
for mod in modules_to_parse:
corrected_maxes = []
for ind, cand in enumerate(maxs[modules_to_parse.index(mod)]):
......@@ -216,6 +231,8 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
index = index + s
#print("Running BayesPairing on sequence window:", index, len(seq))
maxs = run_BP(seq[index:], ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k,sscons)
if interm:
print('PURE SEQUENCE RESULTS:',maxs)
for mod in modules_to_parse:
corrected_maxes = []
for ind, cand in enumerate(maxs[modules_to_parse.index(mod)]):
......@@ -358,6 +375,7 @@ if __name__ == "__main__":
parser.add_argument("-s", help="Step size between windows [10 to 200]. Default:100 ")
parser.add_argument("-sw", help="weight of the secondary structure analysis [0.8 to 2]. Default:1 ")
parser.add_argument("-o", help="Name of the output file. Default: output ")
parser.add_argument("-interm", help="output the best intermediate results. (use -interm 1)")
parser.add_argument("-sscons", help="Constraint level of the module-secondary structure match. Integer from 0 to 5, 0 being most constrained")
args = parser.parse_args()
......@@ -387,6 +405,8 @@ if __name__ == "__main__":
arguments["sscons"] = args.sscons
if args.mod != None:
arguments["mod"] = args.mod
if args.interm != None:
arguments["interm"] = args.mod
if args.seq != None:
seq = args.seq
else:
......
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