Commit 962111e7 authored by Carsten Kemena's avatar Carsten Kemena

changed to have only one output file optionally with alignments

parent ed735a1d
......@@ -57,7 +57,8 @@ int
main(int argc, char *argv[])
{
std::string version(std::string(STR(MAJOR_VERSION)) + "." + std::string(STR(MINOR_VERSION)) + "." + std::string(STR(PATCH_VERSION)) );
fs::path queryDomainFile, querySeqFile, outFile, domainDB, alignmentFile;
fs::path queryDomainFile, querySeqFile, outFile, domainDB;
bool listAlignments;
fs::path prefix;
vector<std::string> q, domains;
......@@ -67,7 +68,7 @@ main(int argc, char *argv[])
("help,h", "Produces this help message")
("db,d", po::value<fs::path>(&prefix)->required(), "The database prefix")
("out,o", po::value<fs::path>(&outFile)->value_name("FILE"), "The output file")
("alignments,f", po::value<fs::path>(&alignmentFile)->value_name("FILE"), "File to write the alignments into")
("list-alignments,l", po::value<bool>(&listAlignments)->default_value(false)->zero_tokens(), "List alignments")
("threads,n", po::value<unsigned short>(&nThreads)->default_value(1), "The number of threads to use")
;
......@@ -229,7 +230,10 @@ main(int argc, char *argv[])
buf << " " << domain.accession();
buf << "\n\n";
buf << "# score | normalized | SeqID | sequence length | domain arrangement | aln\n";
buf << "# score | normalized | SeqID | sequence length | domain arrangement";
if (listAlignments)
buf << " | aln";
buf << "\n";
buf << "# -------------------------------------------------------------------\n";
buf.setf(ios::fixed, ios::floatfield);
buf.precision(2);
......@@ -237,7 +241,8 @@ main(int argc, char *argv[])
for (auto &hit : results.targets)
{
++alnNumber;
alnbuf << std::to_string(alnNumber) + "\n" + hit.alnStringQuery + "\n" + hit.alnStringTarget + "\n\n";
if (listAlignments)
alnbuf << std::to_string(alnNumber) + ")\nQuery DA: " + hit.alnStringQuery + "\nTarget DA: " + hit.alnStringTarget + "\n\n";
for (auto &seq : hit.targetSequences)
{
//const auto &hit = result.;
......@@ -247,15 +252,27 @@ main(int argc, char *argv[])
buf << da[0].accession() << " " << da[0].start() << " " << da[0].end();
for (size_t i = 1; i<len; ++i)
buf << " " << da[i].accession() << " " << da[i].start() << " " << da[i].end();
if (listAlignments)
buf << "\t" << alnNumber;
buf << "\n";
}
}
buf << "\n\n";
#pragma omp critical
outS << buf.rdbuf();
std::cout << alnbuf.rdbuf();
#pragma omp critical(print_ouptut)
{
outS << buf.rdbuf();
if (listAlignments)
{
outS << "# -------------------------------------------------------------------\n";
outS << "List of alignments:\n";
outS << "# -------------------------------------------------------------------\n\n";
outS << alnbuf.rdbuf();
}
}
}
outS.close();
return EXIT_SUCCESS;
......
......@@ -56,6 +56,12 @@
run diff <(grep -v '#' test3Res.txt) <(grep -v '#' results/test3Res.txt)
[ $status == 0 ]
run ../../build/rads -D PF00001 PF00002 PF00003 -m pfam-31.dsm -d interPro-test -l -o test3bRes.txt
[ $status == 0 ]
run diff <(grep -v '#' test3bRes.txt) <(grep -v '#' results/test3bRes.txt)
[ $status == 0 ]
run ../../build/rads -D PF00001 PF00002 PF00003 -m pfam-31.dsm -d interPro-test -o test4Res.txt -c
[ $status == 0 ]
......@@ -63,5 +69,5 @@
[ $status == 0 ]
rm interPro-test.db interPro-test.da
rm test3Res.txt test2Res.txt test4Res.txt
rm test3Res.txt test3bRes.txt test2Res.txt test4Res.txt
}
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