Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 1e33abbe authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-a/filter-updates' into 'dev'

Filter, more strict tests

See merge request !893
parents 16f0c36a e889c2ff
Pipeline #212171 canceled with stages
......@@ -40,6 +40,7 @@ void FilterWithACAutomaton::buildACAutomatonToFilterBioReader(string seed){
asciiNumber++;
}
if(asciiNumber > 127){
cerr << WARNING_STRING << "Pre-filtering disabled" << endl;
delete automaton; delete indexes;
automaton = nullptr;
indexes = nullptr;
......
#ifndef FILTER_H
#define FILTER_H
#include <iostream>
#include "bioreader.hpp"
#include "automaton.hpp"
......
......@@ -346,16 +346,19 @@ void testFilterBioReaderWithACAutomaton(){
void testGetNSignicativeKmers(){
BioReader filtered;
BioReader seqV("../../germline/homo-sapiens/IGHV.fa", 2);
BioReader seqV("../../germline/homo-sapiens/IGHV.fa", 2, "|");
string SIZE_ERROR = "Filtered size must be less than original one";
string SIZE_ERROR = "Filtered BioReader should be 10x smaller";
string GENE_NOT_FOUND = "Filtering sequence not found after filter";
FilterWithACAutomaton *f = new FilterWithACAutomaton(seqV, "########");
int total_filtered = 0;
// Check filter behaviour for each IGHV gene
for(int i = 0; i < seqV.size(); ++i){
Sequence seq = seqV.read(i);
FilterWithACAutomaton *f = new FilterWithACAutomaton(seqV, "########");
filtered = f->filterBioReaderWithACAutomaton(seq.sequence, 1);
delete f;
int j = 0;
while(j < filtered.size()){
if(extractGeneName(filtered.label(j)) == extractGeneName(seq.label)){
......@@ -364,8 +367,15 @@ void testGetNSignicativeKmers(){
++j;
}
TAP_TEST(j < filtered.size(), TEST_FILTER_BIOREADER_WITH_AC_AUTOMATON, GENE_NOT_FOUND);
TAP_TEST(filtered.size() < seqV.size(), TEST_FILTER_BIOREADER_WITH_AC_AUTOMATON, SIZE_ERROR);
TAP_TEST(filtered.size() < seqV.size() / 10, TEST_FILTER_BIOREADER_WITH_AC_AUTOMATON, SIZE_ERROR + ", " + seq.label + ", " + string_of_int(filtered.size()) + "/" + string_of_int(seqV.size()));
total_filtered += filtered.size();
}
delete f;
float ratio = ((float) total_filtered) / (seqV.size()*seqV.size());
TAP_TEST_APPROX(ratio, 0.02, 0.005, TEST_FILTER_BIOREADER_WITH_AC_AUTOMATON, "Average filtering ratio on IGHV");
}
/*
......
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