Skip to content
代码片段 群组 项目
提交 a209dc4c 编辑于 作者: Shifu Chen's avatar Shifu Chen
浏览文件

output debug info for index filtering

上级 4e296959
标签
无相关合并请求
......@@ -197,14 +197,15 @@ void Options::initIndexFiltering(string blacklistFile1, string blacklistFile2, i
if(blacklistFile1.empty() && blacklistFile2.empty())
return;
if(!blacklistFile1.empty())
if(!blacklistFile1.empty()){
check_file_valid(blacklistFile1);
indexFilter.blacklist1 = makeListFromFileByLine(blacklistFile1);
}
if(!blacklistFile2.empty())
if(!blacklistFile2.empty()){
check_file_valid(blacklistFile2);
indexFilter.blacklist1 = makeListFromFileByLine(blacklistFile1);
indexFilter.blacklist2 = makeListFromFileByLine(blacklistFile2);
indexFilter.blacklist2 = makeListFromFileByLine(blacklistFile2);
}
if(indexFilter.blacklist1.empty() && indexFilter.blacklist2.empty())
return;
......@@ -213,12 +214,13 @@ void Options::initIndexFiltering(string blacklistFile1, string blacklistFile2, i
indexFilter.threshold = threshold;
}
vector<string> Options::makeListFromFileByLine(string blacklistFile1) {
vector<string> Options::makeListFromFileByLine(string filename) {
vector<string> ret;
ifstream file;
file.open(blacklistFile1.c_str(), ifstream::in);
file.open(filename.c_str(), ifstream::in);
const int maxLine = 1000;
char line[maxLine];
cerr << "filter by index, loading " << filename << endl;
while(file.getline(line, maxLine)){
// trim \n, \r or \r\n in the tail
int readed = strlen(line);
......@@ -232,10 +234,12 @@ vector<string> Options::makeListFromFileByLine(string blacklistFile1) {
string linestr(line);
for(int i=0; i<linestr.length(); i++) {
if(linestr[i] != 'A' && linestr[i] != 'T' && linestr[i] != 'C' && linestr[i] != 'G') {
error_exit("processing " + blacklistFile1 + ", each line should be one barcode, which can only contain A/T/C/G");
error_exit("processing " + filename + ", each line should be one barcode, which can only contain A/T/C/G");
}
}
cerr << linestr << endl;
ret.push_back(linestr);
}
cerr << endl;
return ret;
}
......@@ -219,7 +219,7 @@ public:
bool validate();
bool adapterCuttingEnabled();
void initIndexFiltering(string blacklistFile1, string blacklistFile2, int threshold = 0);
vector<string> makeListFromFileByLine(string blacklistFile1);
vector<string> makeListFromFileByLine(string filename);
public:
// file name of read1 input
......
......@@ -186,11 +186,6 @@ bool PairEndProcessor::processPairEnd(ReadPairPack* pack, ThreadConfig* config){
ReadPair* pair = pack->data[p];
Read* or1 = pair->mLeft;
Read* or2 = pair->mRight;
// filter by index
if(mFilter->filterByIndex(or1, or2)) {
delete pair;
continue;
}
int lowQualNum1 = 0;
int nBaseNum1 = 0;
......@@ -201,6 +196,12 @@ bool PairEndProcessor::processPairEnd(ReadPairPack* pack, ThreadConfig* config){
config->getPreStats1()->statRead(or1);
config->getPreStats2()->statRead(or2);
// filter by index
if(mOptions->indexFilter.enabled && mFilter->filterByIndex(or1, or2)) {
delete pair;
continue;
}
// umi processing
if(mOptions->umi.enabled)
mUmiProcessor->process(or1, or2);
......
......@@ -157,14 +157,15 @@ bool SingleEndProcessor::processSingleEnd(ReadPack* pack, ThreadConfig* config){
// original read1
Read* or1 = pack->data[p];
// stats the original read before trimming
config->getPreStats1()->statRead(or1);
// filter by index
if(mFilter->filterByIndex(or1)) {
if(mOptions->indexFilter.enabled && mFilter->filterByIndex(or1)) {
delete or1;
continue;
}
// stats the original read before trimming
config->getPreStats1()->statRead(or1);
// umi processing
if(mOptions->umi.enabled)
......
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册