Commit 8f7be3f1 authored by Carsten Kemena's avatar Carsten Kemena

fixed non-reversabel collapse

parent 9e07b28b
Pipeline #653 passed with stages
in 3 minutes and 28 seconds
......@@ -420,7 +420,10 @@ public:
for (size_t i=1; i<nDomains; ++i)
{
if (domains_[pos].accession() != domains_[i].accession())
domains_[++pos] = std::move(domains_[i]);
{
if (++pos != i)
domains_[pos] = std::move(domains_[i]);
}
}
domains_.resize(++pos);
}
......
......@@ -63,7 +63,6 @@ BOOST_AUTO_TEST_CASE(DA_Insert_Test)
}
BOOST_AUTO_TEST_CASE( cos_test )
{
boost::filesystem::path path = BioSeqDataLib::getEnv("DOMAINWORLD_DATA");
......@@ -170,6 +169,44 @@ BOOST_AUTO_TEST_CASE(Sort_check)
BOOST_AUTO_TEST_CASE(Collapse_check)
{
BioSeqDataLib::DomainArrangement<BioSeqDataLib::Domain> da;
da.emplace_back("A", 1, 40, 0.4, BioSeqDataLib::DomainDB::pfam);
da.emplace_back("A", 100, 101, 0.4, BioSeqDataLib::DomainDB::pfam);
da.emplace_back("C", 1000, 3000, 0.4, BioSeqDataLib::DomainDB::pfam);
da.collapse();
BOOST_CHECK_EQUAL(da.size(), 2);
BOOST_CHECK_EQUAL(da[0].accession(), "A");
BOOST_CHECK_EQUAL(da[1].accession(), "C");
BOOST_CHECK_EQUAL(da.str(), "A-C");
BioSeqDataLib::DomainArrangement<BioSeqDataLib::Domain> da2;
da2.emplace_back("PF00007", 1, 40, 0.4, BioSeqDataLib::DomainDB::pfam);
da2.emplace_back("PF00008", 100, 101, 0.4, BioSeqDataLib::DomainDB::pfam);
da2.emplace_back("PF00009", 1000, 3000, 0.4, BioSeqDataLib::DomainDB::pfam);
da2.emplace_back("PF00010", 10000, 30000, 0.4, BioSeqDataLib::DomainDB::pfam);
da2.collapse();
BOOST_CHECK_EQUAL(da2[1].accession(), "PF00008");
BOOST_CHECK_EQUAL(da2.size(), 4);
BOOST_CHECK_EQUAL(da2.str(), "PF00007-PF00008-PF00009-PF00010");
BioSeqDataLib::DomainArrangement<BioSeqDataLib::Domain> da3;
da3.emplace_back("PF00007", 1, 40, 0.4, BioSeqDataLib::DomainDB::pfam);
da3.emplace_back("PF00008", 100, 101, 0.4, BioSeqDataLib::DomainDB::pfam);
da3.emplace_back("PF00008", 102, 104, 0.4, BioSeqDataLib::DomainDB::pfam);
da3.emplace_back("PF00009", 1000, 3000, 0.4, BioSeqDataLib::DomainDB::pfam);
da3.emplace_back("PF00010", 10000, 30000, 0.4, BioSeqDataLib::DomainDB::pfam);
da3.emplace_back("PF00010", 300000, 3000000, 0.4, BioSeqDataLib::DomainDB::pfam);
da3.collapse();
BOOST_CHECK_EQUAL(da3[1].accession(), "PF00008");
BOOST_CHECK_EQUAL(da3.size(), 4);
BOOST_CHECK_EQUAL(da3.str(), "PF00007-PF00008-PF00009-PF00010");
}
BOOST_AUTO_TEST_SUITE_END()
......
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