Skip to content

Commit

Permalink
[NOMERGE] rename from my_to → to
Browse files Browse the repository at this point in the history
  • Loading branch information
SGSSGene committed Apr 27, 2022
1 parent d0e89cb commit b480d73
Show file tree
Hide file tree
Showing 26 changed files with 63 additions and 63 deletions.
4 changes: 2 additions & 2 deletions doc/tutorial/alphabet/alphabet_gc_content.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main (int argc, char * argv[])
sequence.push_back( seqan3::assign_char_to(c, seqan3::dna5{}) );

// Optional: use views for the conversion. Views will be introduced in the next chapter.
//std::vector<seqan3::dna5> sequence = input | seqan3::views::char_to<seqan3::dna5> | seqan3::views::my_to<std::vector>();
//std::vector<seqan3::dna5> sequence = input | seqan3::views::char_to<seqan3::dna5> | seqan3::views::to<std::vector>();

// Initialise an array with count values for dna5 symbols.
std::array<size_t, seqan3::dna5::alphabet_size> count{}; // default initialised with zeroes
Expand All @@ -56,5 +56,5 @@ void alternatively()
{
std::string input{};
// if something changes in here, please update above:
std::vector<seqan3::dna5> sequence = input | seqan3::views::char_to<seqan3::dna5> | seqan3::views::my_to<std::vector>();
std::vector<seqan3::dna5> sequence = input | seqan3::views::char_to<seqan3::dna5> | seqan3::views::to<std::vector>();
}
4 changes: 2 additions & 2 deletions include/seqan3/io/sam_file/format_sam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ inline void format_sam::read_sequence_record(stream_type & stream,
throw parse_error{"The id information must not be empty."};

if (options.truncate_ids)
id = id | detail::take_until_and_consume(is_space) | views::my_to<id_type>();
id = id | detail::take_until_and_consume(is_space) | views::to<id_type>();
}

//!\copydoc sequence_file_output_format::write_sequence_record
Expand Down Expand Up @@ -1043,7 +1043,7 @@ inline void format_sam::read_sam_dict_field(stream_view_type && stream_view, sam
}
case 'Z' : // string
{
target[tag] = stream_view | views::my_to<std::string>();
target[tag] = stream_view | views::to<std::string>();
break;
}
case 'H' :
Expand Down
2 changes: 1 addition & 1 deletion include/seqan3/io/structure_file/format_vienna.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class format_vienna
{
std::string e_str = stream_view | detail::take_line
| std::views::filter(!(is_space || is_char<'('> || is_char<')'>))
| views::my_to<std::string>();
| views::to<std::string>();

if (!e_str.empty())
{
Expand Down
2 changes: 1 addition & 1 deletion include/seqan3/utility/container/dynamic_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ class dynamic_bitset
template <typename char_t>
friend debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & s, dynamic_bitset arg)
{
s << (std::string_view{arg.to_string()} | views::interleave(4, std::string_view{"'"}) | views::my_to<std::string>());
s << (std::string_view{arg.to_string()} | views::interleave(4, std::string_view{"'"}) | views::to<std::string>());
return s;
}
//!\}
Expand Down
4 changes: 2 additions & 2 deletions include/seqan3/utility/views/to.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace seqan3::views {
* \noapi{}
*/
template <typename T>
constexpr auto my_to() {
constexpr auto to() {
return detail::adaptor_from_functor{detail::to_fn<T>{}};
}

Expand All @@ -122,7 +122,7 @@ constexpr auto my_to() {
* \noapi{}
*/
template <template<class...> typename T>
constexpr auto my_to() {
constexpr auto to() {
return detail::adaptor_from_functor{detail::to_template_template_fn<T>{}};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void seqan3_affine_dna4_parallel(benchmark::State & state)
{
auto [vec1, vec2] = generate_data_seqan3<seqan3::dna4>();

auto data = seqan3::views::zip(vec1, vec2) | seqan3::views::my_to<std::vector>();
auto data = seqan3::views::zip(vec1, vec2) | seqan3::views::to<std::vector>();

int64_t total = 0;
for (auto _ : state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void sequential_read(benchmark::State & state)
if constexpr (std::is_same_v<tag_t, baseline_tag>)
{
seqan3::aa27_vector translated_aa_sequence = dna_sequence | seqan3::views::translate_single
| seqan3::views::my_to<seqan3::aa27_vector>();
| seqan3::views::to<seqan3::aa27_vector>();
sequential_read_impl(state, translated_aa_sequence);
}
else if constexpr (std::is_same_v<tag_t, translate_tag>)
Expand Down Expand Up @@ -87,7 +87,7 @@ void random_access(benchmark::State & state)
if constexpr (std::is_same_v<tag_t, baseline_tag>)
{
seqan3::aa27_vector translated_aa_sequence = dna_sequence | seqan3::views::translate_single
| seqan3::views::my_to<seqan3::aa27_vector>();
| seqan3::views::to<seqan3::aa27_vector>();
random_access_impl(state, translated_aa_sequence, access_positions);
}
else
Expand All @@ -111,7 +111,7 @@ void copy_impl(benchmark::State & state, std::vector<seqan3::dna4> const & dna_s
{
seqan3::aa27_vector translated_aa_sequence{};
benchmark::DoNotOptimize(translated_aa_sequence = dna_sequence | adaptor
| seqan3::views::my_to<seqan3::aa27_vector>());
| seqan3::views::to<seqan3::aa27_vector>());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void sequential_read(benchmark::State & state)
{
std::vector<seqan3::aa27_vector> translated_aa_sequences = dna_sequence_collection
| seqan3::views::translate_join
| seqan3::views::my_to<std::vector<seqan3::aa27_vector>>();
| seqan3::views::to<std::vector<seqan3::aa27_vector>>();
sequential_read_impl(state, translated_aa_sequences);
}
else if constexpr (std::is_same_v<tag_t, translate_tag>)
Expand Down Expand Up @@ -119,7 +119,7 @@ void random_access(benchmark::State & state)
{
std::vector<seqan3::aa27_vector> translated_aa_sequences = dna_sequence_collection
| seqan3::views::translate_join
| seqan3::views::my_to<std::vector<seqan3::aa27_vector>>();
| seqan3::views::to<std::vector<seqan3::aa27_vector>>();
random_access_impl(state, translated_aa_sequences, access_positions_outer, access_positions_inner);
}
else
Expand All @@ -146,7 +146,7 @@ void copy_impl(benchmark::State & state,
std::vector<seqan3::aa27_vector> translated_aa_sequences{};
benchmark::DoNotOptimize(translated_aa_sequences = dna_sequence_collection
| adaptor
| seqan3::views::my_to<std::vector<seqan3::aa27_vector>>());
| seqan3::views::to<std::vector<seqan3::aa27_vector>>());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void sequential_read(benchmark::State & state)
{
std::vector<seqan3::aa27_vector> translated_aa_sequences = dna_sequence_collection
| seqan3::views::translate_join
| seqan3::views::my_to<std::vector<seqan3::aa27_vector>>();
| seqan3::views::to<std::vector<seqan3::aa27_vector>>();
sequential_read_impl(state, translated_aa_sequences);
}
else if constexpr (std::is_same_v<tag_t, translate_tag>)
Expand Down Expand Up @@ -106,7 +106,7 @@ void random_access(benchmark::State & state)
{
std::vector<seqan3::aa27_vector> translated_aa_sequences = dna_sequence_collection
| seqan3::views::translate_join
| seqan3::views::my_to<std::vector<seqan3::aa27_vector>>();
| seqan3::views::to<std::vector<seqan3::aa27_vector>>();
random_access_impl(state, translated_aa_sequences, access_positions);
}
else
Expand Down
2 changes: 1 addition & 1 deletion test/performance/io/format_vienna_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ inline constexpr size_t iterations_per_run = 1024;

inline std::string const header{"seq foobar blobber"};
inline auto const rna_sequence = seqan3::test::generate_sequence<seqan3::rna4>(474, 0, 0);
auto const sequence = rna_sequence | seqan3::views::to_char | seqan3::views::my_to<std::string>();
auto const sequence = rna_sequence | seqan3::views::to_char | seqan3::views::to<std::string>();

inline std::string const structure
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void clear_benchmark(::benchmark::State & state)

std::vector<seqan3::bin_index> bin_range = std::views::iota(0u, static_cast<size_t>(state.range(0)))
| std::views::transform([] (size_t i) { return seqan3::bin_index{i}; })
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();

for (auto _ : state)
{
Expand All @@ -105,7 +105,7 @@ void clear_range_benchmark(::benchmark::State & state)

std::vector<seqan3::bin_index> bin_range = std::views::iota(0u, static_cast<size_t>(state.range(0)))
| std::views::transform([] (size_t i) { return seqan3::bin_index{i}; })
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();


for (auto _ : state)
Expand Down
10 changes: 5 additions & 5 deletions test/performance/search/index_construction_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct sequence_store_seqan3
std::string const char_rng{[] ()
{
std::vector<uint8_t> const ranks{seqan3::test::generate_numeric_sequence<uint8_t>(max_length, 0, 253, seed)};
return ranks | seqan3::views::rank_to<char> | seqan3::views::my_to<std::string>();
return ranks | seqan3::views::rank_to<char> | seqan3::views::to<std::string>();
}()};
};

Expand All @@ -69,11 +69,11 @@ void index_benchmark_seqan3(benchmark::State & state)
rng_t sequence;
inner_rng_t inner_sequence;
if constexpr (std::same_as<alphabet_t, seqan3::dna4>)
inner_sequence = store.dna4_rng | std::views::take(state.range(0)) | seqan3::views::my_to<inner_rng_t>();
inner_sequence = store.dna4_rng | std::views::take(state.range(0)) | seqan3::views::to<inner_rng_t>();
else if constexpr (std::same_as<alphabet_t, seqan3::aa27>)
inner_sequence = store.aa27_rng | std::views::take(state.range(0)) | seqan3::views::my_to<inner_rng_t>();
inner_sequence = store.aa27_rng | std::views::take(state.range(0)) | seqan3::views::to<inner_rng_t>();
else
inner_sequence = store.char_rng | std::views::take(state.range(0)) | seqan3::views::my_to<inner_rng_t>();
inner_sequence = store.char_rng | std::views::take(state.range(0)) | seqan3::views::to<inner_rng_t>();

if constexpr (seqan3::range_dimension_v<rng_t> == 1)
{
Expand Down Expand Up @@ -104,7 +104,7 @@ struct sequence_store_seqan2
seqan::String<char> const char_rng{[] ()
{
std::vector<uint8_t> const ranks{seqan3::test::generate_numeric_sequence<uint8_t>(max_length, 0, 253, seed)};
return ranks | seqan3::views::rank_to<char> | seqan3::views::my_to<std::string>();
return ranks | seqan3::views::rank_to<char> | seqan3::views::to<std::string>();
}()};
};

Expand Down
2 changes: 1 addition & 1 deletion test/performance/search/search_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ std::vector<alphabet_t> generate_repeating_sequence(size_t const template_length
return generate_reads(seq_template, repeats, len, simulated_errors, 0.15, 0.15)
| seqan3::detail::persist
| std::views::join
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();
}

//============================================================================
Expand Down
2 changes: 1 addition & 1 deletion test/performance/utility/simd/views/to_simd_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void to_simd_naive_wo_condition(benchmark::State& state)
{
return std::pair{std::ranges::size(std::get<0>(tpl)), std::get<1>(tpl)};
})
| seqan3::views::my_to<std::vector<std::pair<size_t, size_t>>>();
| seqan3::views::to<std::vector<std::pair<size_t, size_t>>>();

std::ranges::sort(sorted_sequences);

Expand Down
4 changes: 2 additions & 2 deletions test/snippet/alphabet/composite/semialphabet_any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void algo_pre(seqan3::aa10li_vector const & v)
{
return static_cast<seqan3::semialphabet_any<10>>(in);
})
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();
algorithm(tmp, false);
}

Expand All @@ -56,7 +56,7 @@ void algo_pre(seqan3::aa10murphy_vector const & v)
{
return static_cast<seqan3::semialphabet_any<10>>(in);
})
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();
algorithm(tmp, true);
}

Expand Down
4 changes: 2 additions & 2 deletions test/snippet/range/views/range_view_all_retransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ int main()
auto vec_view2 = seqan3::views::complement(vec);

// re-convert to container
seqan3::dna4_vector complemented = vec_view2 | seqan3::views::my_to<seqan3::dna4_vector>();
seqan3::dna4_vector complemented = vec_view2 | seqan3::views::to<seqan3::dna4_vector>();
assert(complemented == "TGCCAG"_dna4);

// also possible in one step
seqan3::dna4_vector reversed = vec | std::views::reverse | seqan3::views::my_to<seqan3::dna4_vector>();
seqan3::dna4_vector reversed = vec | std::views::reverse | seqan3::views::to<seqan3::dna4_vector>();
assert(reversed == "CTGGCA"_dna4);
}
2 changes: 1 addition & 1 deletion test/snippet/utility/views/convert_int_to_bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ int main()
seqan3::debug_stream << (vec | seqan3::views::convert<bool> | std::views::reverse) << '\n'; // [1,1,1,0,0,1,0,1,1]

// function notation and immediate conversion to vector again
auto bool_vec = seqan3::views::convert<bool>(vec) | seqan3::views::my_to<std::vector<bool>>();
auto bool_vec = seqan3::views::convert<bool>(vec) | seqan3::views::to<std::vector<bool>>();
seqan3::debug_stream << std::boolalpha << (bool_vec == std::vector<bool>{1,1,0,1,0,0,1,1,1}) << '\n'; // true
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ TEST(debug_stream_test, multiple_alignment_without_gaps)
std::vector<seqan3::gapped<seqan3::dna4>>> const alignment
{
"GCGGGTCACTGAGGGCTGGGATGAGGACGGCCACCACTTCGAGGAGTCCCTTCACTACGAGGGCAGGGCCGTGGACATCACCACGTCAGACAGGGACAAGAGCAAGTA"
"CGGCACCCTGTCCAGACTGGCGGTGGAAGCTG"_dna4 | seqan3::views::my_to<std::vector<seqan3::gapped<seqan3::dna4>>>(),
"CGGCACCCTGTCCAGACTGGCGGTGGAAGCTG"_dna4 | seqan3::views::to<std::vector<seqan3::gapped<seqan3::dna4>>>(),
"CTACGGCAGAAGAAGACATCCGAAAAAGCTGACACCTCTCGCCTACAAGCAGTTCATACCTAATGTCGCGGAGAAGACCTTAGGGGCCAGCGGCAGATACGAGGGCAA"
"GATAACGCGCAATTCGGAGAGATTTAAAGAAC"_dna4 | seqan3::views::my_to<std::vector<seqan3::gapped<seqan3::dna4>>>(),
"GATAACGCGCAATTCGGAGAGATTTAAAGAAC"_dna4 | seqan3::views::to<std::vector<seqan3::gapped<seqan3::dna4>>>(),
"CTACGGCAGAAGAAGACATCCCAAGAAGCTGACACCTCTCGCCTACAAGCAGTTTATACCTAATGTCGCGGAGAAGACCTTAGGGGCCAGCGGCAGATACGAGGGCAA"
"GATCACGCGCAATTCGGAGAGATTTAAAGAAC"_dna4 | seqan3::views::my_to<std::vector<seqan3::gapped<seqan3::dna4>>>()
"GATCACGCGCAATTCGGAGAGATTTAAAGAAC"_dna4 | seqan3::views::to<std::vector<seqan3::gapped<seqan3::dna4>>>()
};

std::ostringstream oss;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ TYPED_TEST_P(pairwise_alignment_collection_test, end_positions)
{
auto [database, query] = fixture.get_sequences();
auto res_vec = seqan3::align_pairwise(seqan3::views::zip(database, query), align_cfg)
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();

EXPECT_RANGE_EQ(res_vec | std::views::transform([] (auto res) { return res.score(); }), fixture.get_scores());
EXPECT_RANGE_EQ(res_vec |
Expand Down Expand Up @@ -89,7 +89,7 @@ TYPED_TEST_P(pairwise_alignment_collection_test, begin_positions)
{
auto [database, query] = fixture.get_sequences();
auto res_vec = seqan3::align_pairwise(seqan3::views::zip(database, query), align_cfg)
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();

EXPECT_RANGE_EQ(res_vec | std::views::transform([] (auto res) { return res.score(); }),
fixture.get_scores());
Expand Down Expand Up @@ -127,7 +127,7 @@ TYPED_TEST_P(pairwise_alignment_collection_test, alignment)
{
auto [database, query] = fixture.get_sequences();
auto res_vec = seqan3::align_pairwise(seqan3::views::zip(database, query), align_cfg)
| seqan3::views::my_to<std::vector>();
| seqan3::views::to<std::vector>();

EXPECT_RANGE_EQ(res_vec | std::views::transform([] (auto res) { return res.score(); }), fixture.get_scores());
EXPECT_RANGE_EQ(res_vec |
Expand All @@ -150,14 +150,14 @@ TYPED_TEST_P(pairwise_alignment_collection_test, alignment)
std::views::transform([] (auto res)
{
return std::get<0>(res.alignment()) | seqan3::views::to_char
| seqan3::views::my_to<std::string>();
| seqan3::views::to<std::string>();
}),
fixture.get_aligned_sequences1());
EXPECT_RANGE_EQ(res_vec |
std::views::transform([] (auto res)
{
return std::get<1>(res.alignment()) | seqan3::views::to_char
| seqan3::views::my_to<std::string>();
| seqan3::views::to<std::string>();
}),
fixture.get_aligned_sequences2());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ struct bi_fm_index_cursor_collection_test : public ::testing::Test
using alphabet_type = typename index_type::alphabet_type;
using text_type = std::vector<alphabet_type>;

static constexpr auto convert = seqan3::views::char_to<alphabet_type> | seqan3::views::my_to<text_type>();
static constexpr auto convert = seqan3::views::char_to<alphabet_type> | seqan3::views::to<text_type>();

text_type text{convert(std::string_view{"ACGGTAGGACGTAGC"})};
text_type text1{convert(std::string_view{"AACGATCGGA"})};
text_type text2{convert(std::string_view{"TGCTACGATCC"})};
text_type text3 = seqan3::views::slice(text, 0, 11) | seqan3::views::my_to<text_type>(); // "ACGGTAGGACG"
text_type text4 = seqan3::views::slice(text, 0, 14) | seqan3::views::my_to<text_type>(); // "ACGGTAGGACGTAG"
text_type text3 = seqan3::views::slice(text, 0, 11) | seqan3::views::to<text_type>(); // "ACGGTAGGACG"
text_type text4 = seqan3::views::slice(text, 0, 14) | seqan3::views::to<text_type>(); // "ACGGTAGGACGTAG"

std::vector<text_type> text_col1{text1, text1};
std::vector<text_type> text_col2{text3, text2};
std::vector<text_type> text_col3{text4, text2};
std::vector<text_type> text_col4{text, text2};

std::vector<text_type> rev_text1 = text_col1 | seqan3::views::deep{std::views::reverse}
| seqan3::views::my_to<std::vector<text_type>>();
| seqan3::views::to<std::vector<text_type>>();
std::vector<text_type> rev_text2 = text_col4 | seqan3::views::deep{std::views::reverse}
| std::views::reverse
| seqan3::views::my_to<std::vector<text_type>>();
| seqan3::views::to<std::vector<text_type>>();

text_type pattern1{convert(std::string_view{"CAG"})};
text_type pattern2{convert(std::string_view{"TT"})};
Expand Down
Loading

0 comments on commit b480d73

Please sign in to comment.