Commit a0ada2db authored by Marc Duez's avatar Marc Duez
Browse files
parents 3ef7a1f4 7c403883
......@@ -126,7 +126,7 @@ clean:
cleanall: clean
make -C data $^
make -C germline $^
make -C $(VIDJIL_ALGO_SRC) cleancoverage
make -C $(VIDJIL_ALGO_SRC) cleanall
.PHONY: all test should clean cleanall distrib data germline unit_coverage should_coverage coverage
......
......@@ -95,6 +95,9 @@ cleancoverage: clean
make -C core cleancoverage
make -C lib cleancoverage
cleanall: cleancoverage
make -C tests cleanall
forcedep:
g++ $(CXXFLAGS) -M $(MAINCORE) > dep.mk
make -C core forcedep
......
......@@ -106,6 +106,7 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
maxOverlap = span;
/* Initialize results */
affect_infos results;
results.max_found = false;
results.max_value = 0;
results.first_pos_max = results.last_pos_max = -1;
......@@ -156,6 +157,10 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
results.nb_before_right++;
}
left_evalue = kms.getProbabilityAtLeastOrAbove(results.nb_before_left,
results.first_pos_max + kms.getS());
right_evalue = kms.getProbabilityAtLeastOrAbove(results.nb_after_right, seq.size() - results.last_pos_max);
/* Main test:
1) do we have enough affectations in good positions ('before' at the left and 'after' at the right) ?
We tolerate some of them in bad positions, but there must be 'ratioMin' more in good positions
......@@ -178,8 +183,7 @@ double KmerAffectAnalyser::getProbabilityAtLeastOrAbove(int at_least) const {
}
pair <double, double> KmerAffectAnalyser::getLeftRightProbabilityAtLeastOrAbove() const {
return make_pair(kms.getProbabilityAtLeastOrAbove(results.nb_before_left, results.first_pos_max + kms.getS()),
kms.getProbabilityAtLeastOrAbove(results.nb_after_right, seq.size() - results.last_pos_max));
return make_pair(left_evalue, right_evalue);
}
const string &KmerAffectAnalyser::getSequence() const{
......
......@@ -119,7 +119,7 @@ class KmerAffectAnalyser: public AffectAnalyser {
IKmerStore<KmerAffect> &kms;
const string &seq;
vector<KmerAffect> affectations;
affect_infos results ;
double left_evalue, right_evalue;
public:
/**
......
......@@ -364,26 +364,31 @@ KmerMultiSegmenter::KmerMultiSegmenter(Sequence seq, MultiGermline *multigermlin
if (the_kseg->isSegmented()) {
// the_kseg->evalue also depends on the number of germlines from the *Multi*KmerSegmenter
the_kseg->evalue = getNbExpected();
if (the_kseg->evalue > threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_NOISY);
}
pair <double, double> p = the_kseg->getKmerAffectAnalyser()->getLeftRightProbabilityAtLeastOrAbove();
pair <double, double> p = getNbExpectedLeftRight();
the_kseg->evalue_left = p.first;
the_kseg->evalue_right = p.second;
if (the_kseg->evalue_left > threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_NOISY); // TOO_FEW_V ?
}
if (the_kseg->evalue_right > threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_NOISY); // TOO_FEW_J ?
if (the_kseg->evalue > threshold_nb_expected
&& the_kseg->evalue_left <= threshold_nb_expected
&& the_kseg->evalue_right <= threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_TOO_FEW_ZERO);
} else if (the_kseg->evalue_left > threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_TOO_FEW_V);
} else if (the_kseg->evalue_right > threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_TOO_FEW_J);
}
}
}
double KmerMultiSegmenter::getNbExpected() const {
double proba = the_kseg->getKmerAffectAnalyser()->getProbabilityAtLeastOrAbove(the_kseg->score);
return multi_germline->germlines.size() * proba;
pair <double, double> p = getNbExpectedLeftRight();
return (p.first + p.second);
}
pair<double,double> KmerMultiSegmenter::getNbExpectedLeftRight() const {
pair <double, double> p = the_kseg->getKmerAffectAnalyser()->getLeftRightProbabilityAtLeastOrAbove();
return pair<double, double>(p.first * multi_germline->germlines.size(), p.second * multi_germline->germlines.size());
}
KmerMultiSegmenter::~KmerMultiSegmenter() {
......
......@@ -214,6 +214,12 @@ class KmerMultiSegmenter
*/
double getNbExpected() const;
/**
* @return expected number of Segmenter that would have yield the maximum score by chance
* on the left part of the read and on the right part of the read respectively.
*/
pair<double,double> getNbExpectedLeftRight() const;
~KmerMultiSegmenter();
KmerSegmenter *the_kseg;
......
......@@ -62,11 +62,14 @@ core:
$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
clean:
rm -f *.o $(EXEC) *.tap *.log should-vdj-tests/*.tap should-vdj-tests/*.log
rm -rf out/
rm -f *.o $(EXEC)
cleancoverage:
rm -f *.gcda *.gcno *.gcov
cleantests:
rm -f *.tap *.log should-vdj-tests/*.tap should-vdj-tests/*.log
rm -rf out/
cleanall: clean cleancoverage cleantests
forcedep:
g++ $(INCLUDE) -M $(SRC) > dep.mk
......
......@@ -218,65 +218,64 @@ def index():
if row.patient.id in keys :
result[row.patient.id]['has_permission'] = True
query = db(
query1 = db(
db.patient.creator == db.auth_user.id
).select(
db.patient.ALL, db.auth_user.ALL
db.patient.id, db.auth_user.last_name
)
for i, row in enumerate(query) :
for i, row in enumerate(query1) :
if row.patient.id in keys :
result[row.patient.id]['creator'] = row.auth_user.last_name
query = db(
query2 = db(
db.patient.id == db.sequence_file.patient_id
).select(
db.patient.ALL, db.sequence_file.ALL
db.patient.id, db.sequence_file.size_file
)
for i, row in enumerate(query) :
for i, row in enumerate(query2) :
if row.patient.id in keys :
result[row.patient.id]['file_count'] += 1
result[row.patient.id]['size'] += row.sequence_file.size_file
query = db(
query3 = db(
(db.patient.id == db.fused_file.patient_id) &
(db.fused_file.config_id == db.config.id)
).select(
db.patient.ALL, db.fused_file.ALL, db.config.ALL
db.patient.id, db.config.name, db.config.id
)
for i, row in enumerate(query) :
for i, row in enumerate(query3) :
if row.patient.id in keys :
result[row.patient.id]['conf_list'].append(row.config.name)
result[row.patient.id]['conf_id_list'].append(row.config.id)
query = db(
query4 = db(
((db.patient.id == db.auth_permission.record_id) | (db.auth_permission.record_id == 0)) &
(db.auth_permission.table_name == 'patient') &
(db.auth_permission.name == 'read') &
(db.auth_group.id == db.auth_permission.group_id)
).select(
db.patient.ALL, db.auth_group.ALL
db.patient.id, db.auth_group.role
)
for i, row in enumerate(query) :
for i, row in enumerate(query4) :
if row.patient.id in keys :
result[row.patient.id]['group_list'].append(row.auth_group.role.replace('user_','u'))
query = db(
query5 = db(
(db.auth_permission.name == "anon") &
(db.auth_permission.table_name == "patient") &
(db.patient.id == db.auth_permission.record_id ) &
(auth.user_group() == db.auth_permission.group_id )
).select(
db.patient.ALL, db.auth_permission.ALL
db.patient.id, db.patient.last_name, db.patient.first_name
)
for i, row in enumerate(query) :
for i, row in enumerate(query5) :
if row.patient.id in keys :
result[row.patient.id]['name'] = row.patient.last_name + " " + row.patient.first_name
for key, row in result.iteritems():
row['most_used_conf'] = max(set(row['conf_id_list']), key=row['conf_id_list'].count)
row['confs'] = ", ".join(list(set(row['conf_list'])))
row['confs'] = ", ".join(list(set(row['conf_list'])))
row['groups'] = ", ".join(filter(lambda g: g != 'admin', set(row['group_list'])))
result = result.values()
......
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