-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
144 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#pragma once | ||
|
||
#include <seqan/sequence/segment_base.h> | ||
|
||
namespace seqan2 | ||
{ | ||
|
||
template <typename TAlphabet, typename TPos> | ||
TAlphabet value(seqan2::Segment<seqan2::Segment<std::span<TAlphabet const> const, InfixSegment>, InfixSegment> const & me, | ||
TPos pos) | ||
{ | ||
assert(pos >= 0); | ||
auto const & host_span = *me.data_host.data_host; | ||
if (pos + seqan2::beginPosition(me) >= host_span.size()) | ||
{ | ||
std::cerr << "pos\t" << pos << '\n'; | ||
std::cerr << "seqan2::beginPosition(me)" << seqan2::beginPosition(me) << '\n'; | ||
std::cerr << "host_span.size()\t" << host_span.size() << '\n'; | ||
} | ||
|
||
assert(me.data_host.data_host); | ||
assert(pos + seqan2::beginPosition(me) < host_span.size()); | ||
return host_span[seqan2::beginPosition(me) + pos]; | ||
} | ||
|
||
template <typename TScore, typename TAlphabet, typename TPos> | ||
TAlphabet value(TScore const & /* Score matrix to avoid ambiguity in overloading */, | ||
seqan2::Segment<seqan2::Segment<std::span<TAlphabet const> const, InfixSegment>, InfixSegment> const & me, | ||
TPos pos) | ||
{ | ||
assert(pos >= 0); | ||
auto const & host_span = *me.data_host.data_host; | ||
if (pos + seqan2::beginPosition(me) >= host_span.size()) | ||
{ | ||
std::cerr << "pos\t" << pos << '\n'; | ||
std::cerr << "seqan2::beginPosition(me)" << seqan2::beginPosition(me) << '\n'; | ||
std::cerr << "host_span.size()\t" << host_span.size() << '\n'; | ||
} | ||
|
||
assert(me.data_host.data_host); | ||
//!TODO: it seems that the span goes out of scope at some point | ||
assert(pos + seqan2::beginPosition(me) < host_span.size()); | ||
return host_span[seqan2::beginPosition(me) + pos]; | ||
} | ||
|
||
template <typename TScore, typename TAlphabet, typename TPosition> | ||
inline TAlphabet sequenceEntryForScore(TScore const & /*scoringScheme*/, | ||
Segment<Segment<std::span<TAlphabet const> const, InfixSegment>, InfixSegment> const & seq, | ||
TPosition pos) | ||
{ | ||
return value(seq, pos); | ||
} | ||
|
||
} // namespace seqan2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters