Commit 6b64da40 authored by Armin Sobhani's avatar Armin Sobhani
Browse files

benchmark commit

parent 03bc5707
......@@ -127,12 +127,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(read_single_fasta, T, seq_types)
BOOST_AUTO_TEST_CASE_TEMPLATE(read_multi_fasta, T, seq_types)
{
std::ifstream in(BOOST_BIOSEQ_TEST_DATA_PATH"/reads.fa");
// std::ifstream in(BOOST_BIOSEQ_TEST_DATA_PATH"/all_genomes.fna");
// std::ifstream in(BOOST_BIOSEQ_TEST_DATA_PATH"/reads.fa");
std::ifstream in(BOOST_BIOSEQ_TEST_DATA_PATH"/all_genomes.fna");
// in >> std::skipws;
// auto start = std::chrono::high_resolution_clock::now();
auto start = std::chrono::high_resolution_clock::now();
std::list<T> reads
{
......@@ -158,11 +158,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(read_multi_fasta, T, seq_types)
// while (in >> s)
// reads.push_back(std::move(s));
// auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
// std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
//auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
//std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
BOOST_CHECK_EQUAL(2, reads.size());
BOOST_CHECK_EQUAL(reads.back().name(), "gi|406593966|ref|NC_018627.1|-40485/2");
// BOOST_CHECK_EQUAL(2, reads.size());
// BOOST_CHECK_EQUAL(reads.back().name(), "gi|406593966|ref|NC_018627.1|-40485/2");
// BOOST_CHECK_EQUAL(22, reads.size());
// BOOST_CHECK_EQUAL(reads.back().name(), "gi|379009272|ref|NC_016893.1|");
......@@ -170,18 +170,22 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(read_multi_fasta, T, seq_types)
// for (auto read : reads | boost)
// std::cout << read.name() << '\n' << read.data() << std::endl;
// for (auto read : reads)
// {
// std::cout << read.name() << '\n'
// << read.data()
// << std::endl;
// boost::copy(
// read | boost::adaptors::replaced('A', 'T')
// // | boost::adaptors::replaced('T', 'A')
// | boost::adaptors::replaced('C', 'G')
// // | boost::adaptors::replaced('G', 'C')
// | boost::adaptors::reversed
// , std::ostream_iterator<char>(std::cout) );
// std::cout << std::endl;
// }
for (auto read : reads)
{
T dst_read;
//std::cout << read.name() << '\n'
// << read.data()
// << std::endl;
boost::copy(
read | boost::adaptors::replaced('A', 'T')
// | boost::adaptors::replaced('T', 'A')
| boost::adaptors::replaced('C', 'G')
// | boost::adaptors::replaced('G', 'C')
| boost::adaptors::reversed
, std::back_inserter(dst_read));
//, std::ostream_iterator<char>(std::cout) );
//std::cout << std::endl;
}
auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
}
......@@ -7,8 +7,8 @@
//
//----------------------------------------------------------------------------//
// #include <chrono>
// #include <iostream>
#include <chrono>
#include <iostream>
// #define BOOST_TEST_MAIN
#define BOOST_TEST_MODULE TestSequence
......@@ -47,24 +47,24 @@ typedef boost::mpl::list<vec_32seq, str_32seq> seq32_types;
BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_char_pointer_n, T, seq_types)
{
// auto start = std::chrono::high_resolution_clock::now();
// for (size_t i = 0; i < 1000000; ++i)
T seq("ATCGN", 4);
// T seq(
// "ACTGCAACTCCAAAGCCACCCCTCACCCACTAGGATACCAACAAACCTACCCACCCTTAACAGTACATAG"
// "TACATAAAGCCATTTACCGTACATAGCACATTACAGTCAAATCCCTTCTCGTCCCCATGGATGACCCCCC"
// "TCAGATAGGGGTCCCTTGACCACCATCCTCCGTGAAATCAATATCCCGCACAAGAGTGCTACTCTCCTCG"
// "CTCCGGGCCCATAACACTTGGGGGTAGCTAAAGTGAACTGTATCCGACATCTGGTTCCTACTTCAGGGTC", 280);
// auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
// std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
auto b = seq.cbegin();
BOOST_CHECK_EQUAL( *b , 'A');
BOOST_CHECK_EQUAL(*(++b), 'T');
BOOST_CHECK_EQUAL(*(++b), 'C');
BOOST_CHECK_EQUAL(*(++b), 'G');
BOOST_CHECK_EQUAL(seq.size(), 4);
BOOST_CHECK(++b == seq.end());
auto start = std::chrono::high_resolution_clock::now();
for (size_t i = 0; i < 1000000; ++i)
//T seq("ATCGN", 4);
T seq(
"ACTGCAACTCCAAAGCCACCCCTCACCCACTAGGATACCAACAAACCTACCCACCCTTAACAGTACATAG"
"TACATAAAGCCATTTACCGTACATAGCACATTACAGTCAAATCCCTTCTCGTCCCCATGGATGACCCCCC"
"TCAGATAGGGGTCCCTTGACCACCATCCTCCGTGAAATCAATATCCCGCACAAGAGTGCTACTCTCCTCG"
"CTCCGGGCCCATAACACTTGGGGGTAGCTAAAGTGAACTGTATCCGACATCTGGTTCCTACTTCAGGGTC", 280);
auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
// auto b = seq.cbegin();
// BOOST_CHECK_EQUAL( *b , 'A');
// BOOST_CHECK_EQUAL(*(++b), 'T');
// BOOST_CHECK_EQUAL(*(++b), 'C');
// BOOST_CHECK_EQUAL(*(++b), 'G');
// BOOST_CHECK_EQUAL(seq.size(), 4);
// BOOST_CHECK(++b == seq.end());
}
BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_wchar_pointer_n, T, wseq_types)
......@@ -108,24 +108,24 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_char32_pointer_n, T, seq32_types)
BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_char_pointer, T, seq_types)
{
// auto start = std::chrono::high_resolution_clock::now();
// for (size_t i = 0; i < 1000000; ++i)
T seq("ATCG");
// T seq(
// "ACTGCAACTCCAAAGCCACCCCTCACCCACTAGGATACCAACAAACCTACCCACCCTTAACAGTACATAG"
// "TACATAAAGCCATTTACCGTACATAGCACATTACAGTCAAATCCCTTCTCGTCCCCATGGATGACCCCCC"
// "TCAGATAGGGGTCCCTTGACCACCATCCTCCGTGAAATCAATATCCCGCACAAGAGTGCTACTCTCCTCG"
// "CTCCGGGCCCATAACACTTGGGGGTAGCTAAAGTGAACTGTATCCGACATCTGGTTCCTACTTCAGGGTC" );
// auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
// std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
auto b = seq.cbegin();
BOOST_CHECK_EQUAL( *b , 'A');
BOOST_CHECK_EQUAL(*(++b), 'T');
BOOST_CHECK_EQUAL(*(++b), 'C');
BOOST_CHECK_EQUAL(*(++b), 'G');
BOOST_CHECK_EQUAL(seq.size(), 4);
BOOST_CHECK(++b == seq.end());
auto start = std::chrono::high_resolution_clock::now();
for (size_t i = 0; i < 1000000; ++i)
// T seq("ATCG");
T seq(
"ACTGCAACTCCAAAGCCACCCCTCACCCACTAGGATACCAACAAACCTACCCACCCTTAACAGTACATAG"
"TACATAAAGCCATTTACCGTACATAGCACATTACAGTCAAATCCCTTCTCGTCCCCATGGATGACCCCCC"
"TCAGATAGGGGTCCCTTGACCACCATCCTCCGTGAAATCAATATCCCGCACAAGAGTGCTACTCTCCTCG"
"CTCCGGGCCCATAACACTTGGGGGTAGCTAAAGTGAACTGTATCCGACATCTGGTTCCTACTTCAGGGTC" );
auto d = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);
std::cout << "Elapsed time: " << d.count() << " ms" << std::endl;
// auto b = seq.cbegin();
// BOOST_CHECK_EQUAL( *b , 'A');
// BOOST_CHECK_EQUAL(*(++b), 'T');
// BOOST_CHECK_EQUAL(*(++b), 'C');
// BOOST_CHECK_EQUAL(*(++b), 'G');
// BOOST_CHECK_EQUAL(seq.size(), 4);
// BOOST_CHECK(++b == seq.end());
}
BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_wchar_pointer, T, wseq_types)
......
Supports Markdown
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