Skip to content

Convert vertor<dna5> to std:string #3218

@nhhaidee

Description

@nhhaidee

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questiona user question how to do certain things

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions