Commit afeaacd0 authored by Carsten Kemena's avatar Carsten Kemena

match threshold per domain

parent ffdd1952
......@@ -83,6 +83,60 @@ words2arrangement(multiset<pair<size_t, std::pair<unsigned short, bool> > > &wor
return arrangement;
}
BSDL::DomainArrangement<BSDL::Domain>
words2arrangement(multiset<pair<size_t, std::pair<unsigned short, bool> > > &wordList, const std::map<unsigned short, int> &m, size_t w)
{
BSDL::DomainArrangement<BSDL::Domain> arrangement;
if (wordList.size() < w)
return arrangement;
map<unsigned short, int> counter;
unsigned short last = 0;
auto it = wordList.begin();
auto itEnd = wordList.end();
short t = 7;
for (size_t i = 0; i<w; ++i, ++it)
{
counter[it->second.first] += 1;
auto it_m = m.find(it->second.first);
if (it_m == m.end())
t=7;
else
t = it_m->second;
if ((counter[it->second.first] >= t) && (arrangement.empty() || (last != it->second.first)))
{
last = it->second.first;
string acc = to_string(it->second.first);
while (acc.size() < 5)
acc = "0" + acc;
arrangement.emplace_back("PF" + acc, it->first, it->first, 0.0);
}
}
auto it2 = wordList.begin();
while (it != itEnd)
{
counter[it2->second.first] -= 1;
counter[it->second.first] += 1;
auto it_m = m.find(it->second.first);
if (it_m == m.end())
t=7;
else
t = it_m->second;
if ((counter[it->second.first] >= t) && (arrangement.empty() || (last != it->second.first)))
{
last = it->second.first;
string acc = to_string(it->second.first);
while (acc.size() < 5)
acc = "0" + acc;
arrangement.emplace_back("PF" + acc, it->first, it->first, 0.0);
}
++it;
++it2;
}
return arrangement;
}
/**
* \brief Reads RADIANT database.
* @param inFile the database file.
......@@ -233,11 +287,12 @@ main(int argc, char const *argv[])
fs::path detailedFile;
po::options_description hiddenO("Hidden options");
int w, m;
int w;//, m;
fs::path m;
hiddenO.add_options()
("detailed", po::value<fs::path>(&detailedFile), "The output file for the detailed results")
("window_size", po::value<int>(&w), "The window size")
("match", po::value<int>(&m), "The number of matches required")
("match", po::value<fs::path>(&m), "The number of matches required")
;
allOpts.add(general).add(outputO).add(translateO).add(hiddenO);
......@@ -329,6 +384,19 @@ main(int argc, char const *argv[])
{*/
//fs::path tmp = outFile;
// tmp += to_string(max_dist) + "_" + to_string(min_count) + ".txt";
//
map<unsigned short, int> domain2match;
std::ifstream file(m.string());
unsigned short p_id;
int threshold;
while(!file.eof())
{
file >> p_id >> threshold; // extracts 2 floating point values seperated by whitespace
domain2match[p_id] = threshold;
// do something with them
}
//
AlgorithmPack::Output out(outFile);
if (!noHeader)
printHeader(radiantVersion, pfamLike, translate, inFile, databaseFile, out);
......@@ -336,9 +404,9 @@ main(int argc, char const *argv[])
{
auto &assignment = assignments[i];
// auto da = words2arrangement(assignment, m, w);
auto da = words2arrangement(assignment, 7, 11);
if (da.size() == 0)
da = words2arrangement(assignment, 3, 5);
auto da = words2arrangement(assignment, domain2match, 10);
//if (da.size() == 0)
// da = words2arrangement(assignment, 3, 5);
if (pfamLike)
{
......
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