Commit c6fcbdc7 authored by Armin Sobhani's avatar Armin Sobhani
Browse files

change fasta file format to use boost::trim_right() to have a better tolerance for whitespaces

parent 7a6961eb
......@@ -11,6 +11,7 @@
#define BOOST_BIOSEQ_IO_FORMATS_FASTA_HPP
// #include <iostream>
#include <boost/algorithm/string.hpp>
namespace boost {
namespace bioseq {
......@@ -48,14 +49,12 @@ private:
std::basic_string<CharT,Traits> line;
line.reserve(200);
std::getline(in, line);
if (line.back() == '\r')
line.pop_back();
boost::trim_right(line);
scan_name(line, s, has_name_component<SeqT>());
while (in.peek() != '>' && std::getline(in, line))
{
if (line.back() == '\r')
line.pop_back();
boost::trim_right(line);
s.insert(s.end(), line.begin(), line.end());
}
......
......@@ -2,17 +2,31 @@
ACACCAGAAGCATCGTCTGTTGTGGTGATATATGCGGGCTCTTCTGTTATCTCGTTAAGATCGAGATGGA
GATTCTTTACTGAGATGTTGTTGGTAGTTTGAAACTTCGTCCCAGGATGCATGCAGAGTATAGATTGAAG
ATTTTCATCA
>gi|406593966|ref|NC_018627.1|-40485/2
TTCTAGTCACAACTTTTTCATTCATTCCCCTGAGTGTAAACTCTCTTCATTTTCTCAAGATCTCACTTTA
GCGGGGGGATCATTAATTTTAGACGAAGGAGTATGTATACAAGCTCCGTCCTTTGATCAAAAGCCTCACT
CTATACTCTT
>gi|406593966|ref|NC_018627.1|-37467/1
GTGGATCACTTCAAGTCAGTTGTTTAGCAGTTCCTGATGCCTTTCTTAATGAGAAGCTTTATGATCGTGC
TATTACGTTTTACCGAAGGATTGTCGAATCTTTCCCTGGTCGTAAGGAGGGATACGAAGCACACTTTCGT
ATAGGCATTG
>gi|406593966|ref|NC_018627.1|-37467/2
TACCGAGGTATTCTAATGGTGCTGCAACACTATCATGTAAAACAGCAAACTCTCTAAGTGCTTGGGAGAA
CCCTTCTTTATCGCCTTCTTCAGCAGCTTTTTCTAATACAGTAATGCGTATACGAAATTGTGCTTCGTAT
CCCTCCGTAC
......@@ -129,9 +129,10 @@ 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"/reads.fas");
// std::ifstream in(BOOST_BIOSEQ_TEST_DATA_PATH"/all_genomes.fna");
// in >> std::skipws;
// auto start = std::chrono::high_resolution_clock::now();
std::vector<T> reads
{
......
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