Skip to content

Commit

Permalink
[FIX] genbank/embl parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Nov 12, 2023
1 parent 285f8e8 commit e746fcb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions include/seqan3/io/sequence_file/format_embl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,10 @@ class format_embl
}
else
{
detail::consume(stream_view | detail::take_until(is_end));
detail::consume(stream_view | detail::take_until_or_throw(is_end)); // consume until "//"
}
//Jump over // and cntrl
++stream_it;
++stream_it;
++stream_it;

std::ranges::advance(stream_it, 3u, std::ranges::end(stream_view)); // Skip `//` and potentially '\n'
}

//!\copydoc sequence_file_output_format::write_sequence_record
Expand Down
9 changes: 5 additions & 4 deletions include/seqan3/io/sequence_file/format_genbank.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class format_genbank
{
constexpr auto is_legal_alph = char_is_valid_for<seq_legal_alph_type>;
std::ranges::copy(
stream_view | std::views::filter(!(is_space || is_digit))
| detail::take_until_or_throw_and_consume(is_end) // consume "//"
stream_view | std::views::filter(!(is_space || is_digit)) // ignore whitespace and numbers
| detail::take_until_or_throw(is_end) // until //
| std::views::transform(
[is_legal_alph](char const c) // enforce legal alphabet
{
Expand All @@ -183,9 +183,10 @@ class format_genbank
}
else
{
detail::consume(stream_view | detail::take_until_or_throw_and_consume(is_end)); // consume until "//"
++stream_it; // consume "/n"
detail::consume(stream_view | detail::take_until_or_throw(is_end)); // consume until "//"
}

std::ranges::advance(stream_it, 3u, std::ranges::end(stream_view)); // Skip `//` and potentially '\n'
}

//!\copydoc sequence_file_output_format::write_sequence_record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ DEFINITION Homo sapiens mRNA for prepro cortistatin like peptide, complete
ACCESSION ID3
ORIGIN
1 ACGTTTA
//
)"};
//)"};

std::string illegal_alphabet_character_input{
R"(LOCUS ID1
Expand Down

0 comments on commit e746fcb

Please sign in to comment.