Convert vertor<dna5> to std:string

Open
#3,218 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
data

Research direction

Start with the seqan3::sequence_file_input loop and inspect the type of seq returned for the selected fields. Check the library's documented conversion or formatting facilities for representing that sequence as std::string; done means the FASTA sequences can be handled as standard C++ strings.

Written by the indexing model from the issue text.

Description

question

Platform

  • SeqAn version: 3.2.0
  • Operating system: Ubuntu
  • Compiler: 11.4

Question

With the following code, is there any way to Convert vertor to std:string as I want to handle C++ standard string?

Thanks,
Hai

auto input = R"(>TEST1
ACGT
>Test2
AGGCTGA
>Test3
GGAGTATAATATATATATATATAT)";

int main(int argc, const char *argv[]) {

    using sequence_file_input_type =
            seqan3::sequence_file_input<seqan3::sequence_file_input_default_traits_dna,
                    seqan3::fields<seqan3::field::seq, seqan3::field::id>,
                    seqan3::type_list<seqan3::format_fasta>>;
    sequence_file_input_type fin{std::istringstream{input}, seqan3::format_fasta{}};
    // Retrieve the sequences and ids.
    for (auto &[seq, id]: fin) {
        seqan3::debug_stream << "ID:  " << id << '\n';
        seqan3::debug_stream << "SEQ: " << seq << '\n';
        // a quality field also exists, but is not printed, because we know it's empty for FASTA files.
    }

    return 0;
}
Dominant language
C++
Stars
463
Forks
90
Avg merge
1h 11m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from seqan/seqan3

All issues in seqan/seqan3

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.