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

returnseq

parent 68240e68
......@@ -20,7 +20,7 @@ def run_BP(seq, ss, modules_to_parse, dataset, left_out, m=8, n=5, sm=0.8, mc=3,
#print("TIME USED:", end - time, "\n")
return maxs
def parse_sequences(input,modules_to_check=[],dataset="",ss="",m=4,n=3,sm=0.3,mc=3,p=25000,k=1,t=25,w=200,s=100,sscons=2):
def parse_sequences(input,modules_to_check=[],dataset="",ss="",m=4,n=3,sm=0.3,mc=3,p=25000,k=1,t=15.7,w=200,s=100,sscons=2):
if dataset=="":
dataset="rna3dmotif"
graphs = pickle.load(open("../models/" + dataset + "_one_of_each_graph.cPickle", "rb"))
......@@ -98,7 +98,7 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
else:
k = 1
if "t" in arguments:
t = int(arguments["t"])
t = float(arguments["t"])
else:
t = 25
if "w" in arguments:
......@@ -121,10 +121,12 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
if "fa" in input and ss=="":
prediction_scores = {}
sequences = []
with open("../src/" + input, "rU") as f:
for num, record in enumerate(SeqIO.parse(f, "fasta")):
id = record.id
seq = str(record.seq)
sequences.append(seq)
#print("PARSING SEQUENCE ", id, "\n")
if "T" in seq:
seq = str(seq).replace("T", "U")
......@@ -173,13 +175,14 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
elif "fa" in input and ss=="infile":
prediction_scores = {}
sequences = []
with open("../src/" + input, "rU") as f:
lines = f.readlines()
for line_n in range(0, len(lines), 3):
id = lines[line_n].strip(">").strip("\n")
seq = lines[line_n+1].strip("\n").strip()
ss = lines[line_n+2].strip("\n").strip()
sequences.append(seq)
p#rint("PARSING SEQUENCE ", id, "\n")
if "T" in seq:
seq = str(seq).replace("T", "U")
......@@ -227,6 +230,7 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
else:
if "T" in input:
input = str(input).replace("T", "U")
sequences = [input]
if len(input) <= 200:
maxs = run_BP(input, ss, modules_to_parse, dataset, "NONE", m, n, sm, mc, p, k,sscons)
all_maxes = []
......@@ -264,7 +268,7 @@ def run_fasta(input, modules_to_parse, dataset, ss="", arguments={}):
all_maxes.append((mod, index, corrected_maxes))
fOUTPUT=fOUTPUT+present_output(all_maxes, t)+"\n"
pickle.dump(all_maxes,open("../output/"+o+".pickle","wb"))
return fOUTPUT
return fOUTPUT,sequences
def seq_ranges(all_pos,sequence):
seq=list(sequence)
......
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