Commit f267edab authored by Marc Duez's avatar Marc Duez
Browse files
parents 61512b78 34fbcbd5
......@@ -2,6 +2,7 @@
#include "kmerstore.h"
#include "read_score.h"
#include "read_chooser.h"
#include "stats.h"
#include <iostream>
using namespace std;
......@@ -84,11 +85,16 @@ void KmerRepresentativeComputer::compute() {
size_t seq_index_longest_run = 1;
Sequence sequence_longest_run;
size_t k = getSeed().length();
Stats stats_length;
for (size_t seq = 1; seq <= sequences.size() && seq <= seq_index_longest_run + stability_limit ; seq++) {
Sequence sequence = rc.getithBest(seq);
stats_length.insert(sequence.sequence.size());
if (sequence.sequence.size() <= length_longest_run) {
break;
continue;
}
size_t pos_required = sequence.sequence.find(required);
if (pos_required == string::npos && revcomp)
......@@ -138,8 +144,15 @@ void KmerRepresentativeComputer::compute() {
representative = sequence_longest_run;
representative.sequence = representative.sequence.substr(pos_longest_run, length_longest_run);
representative.label = representative.label + "-[" + string_of_int(pos_longest_run) + ","
+ string_of_int(pos_longest_run + length_longest_run - 1) + "]";
+ string_of_int(pos_longest_run + length_longest_run - 1) + "]"
+ "-#" + string_of_int(seq_index_longest_run);
representative.quality = "";
int length = stats_length.getAverage();
float ratio = length_longest_run / length;
representative.label += " - " + string_of_int(length_longest_run) + " bp"
+ " (" + string_of_int(100 * ratio) + "% of " + string_of_int(length) + " bp)";
}
delete index;
}
......@@ -2,6 +2,7 @@
import os
import sys
import defs
import re
TASK_TIMEOUT = 15 * 60
......@@ -85,7 +86,8 @@ def run_vidjil(id_file, id_config, id_data, id_fuse, clean_before=False, clean_a
vidjil_cmd = vidjil_cmd.replace( 'germline/' ,germline_folder)
os.makedirs(out_folder)
vidjil_log_file = open(out_folder+'/'+output_filename+'.vidjil.log', 'w')
out_log = out_folder+'/'+output_filename+'.vidjil.log'
vidjil_log_file = open(out_log, 'w')
## commande complete
cmd = defs.DIR_VIDJIL + '/vidjil ' + ' -o ' + out_folder + " -b " + output_filename
......@@ -114,6 +116,33 @@ def run_vidjil(id_file, id_config, id_data, id_fuse, clean_before=False, clean_a
print "!!! Vidjil failed, no .vidjil file"
raise IOError
## Parse some info in .log
vidjil_log_file.close()
segmented = re.compile("==> segmented (\d+) reads \((\d*\.\d+|\d+)%\)")
windows = re.compile("==> found (\d+) .*-windows in .* segments .* inside (\d+) sequences")
info = ''
reads = None
segs = None
ratio = None
wins = None
for l in open(out_log):
m = segmented.search(l)
if m:
print l,
segs = int(m.group(1))
ratio = m.group(2)
info = "%d segmented (%s%%)" % (segs, ratio)
continue
m = windows.search(l)
if m:
print l,
wins = int(m.group(1))
reads = int(m.group(2))
info = "%d reads, " % reads + info + ", %d windows" % wins
break
## insertion dans la base de donnée
ts = time.time()
......@@ -134,7 +163,7 @@ def run_vidjil(id_file, id_config, id_data, id_fuse, clean_before=False, clean_a
config_name = db.config[id_config].name
res = {"message": "[%s] c%s: Vidjil finished - %s" % (id_data, id_config, out_folder)}
res = {"message": "[%s] c%s: Vidjil finished - %s - %s" % (id_data, id_config, info, out_folder)}
log.info(res)
run_fuse(id_file, id_config, id_data, id_fuse, clean_before = False)
......
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