Skip to content

Commit 583f671

Browse files
committed
[nop] reformat
1 parent 29745d7 commit 583f671

22 files changed

Lines changed: 1890 additions & 1763 deletions

src/bisulfite_scoring.hpp

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#include <seqan/score.h>
2525
#include <seqan/sequence.h>
2626

27+
#include <algorithm>
2728
#include <seqan3/alignment/scoring/scoring_scheme_base.hpp>
2829
#include <seqan3/alphabet/nucleotide/dna5.hpp>
29-
#include <algorithm>
3030

3131
enum class bsDirection
3232
{
@@ -35,41 +35,46 @@ enum class bsDirection
3535
};
3636

3737
template <seqan3::arithmetic score_type = int8_t>
38-
class bisulfite_scoring_scheme : public seqan3::scoring_scheme_base<bisulfite_scoring_scheme<score_type>, seqan3::dna5, score_type>
38+
class bisulfite_scoring_scheme :
39+
public seqan3::scoring_scheme_base<bisulfite_scoring_scheme<score_type>, seqan3::dna5, score_type>
3940
{
4041
private:
4142
using base_t = seqan3::scoring_scheme_base<bisulfite_scoring_scheme<score_type>, seqan3::dna5, score_type>;
4243
using base_t::matrix;
44+
4345
public:
4446
using base_t::base_t;
4547
using typename base_t::matrix_type;
46-
using matrix_size_type = std::remove_const_t<decltype(seqan3::alphabet_size<seqan3::dna5>)>;
48+
using matrix_size_type = std::remove_const_t<decltype(seqan3::alphabet_size<seqan3::dna5>)>;
4749
static constexpr matrix_size_type matrix_size = seqan3::alphabet_size<seqan3::dna5>;
4850

4951
constexpr bisulfite_scoring_scheme() noexcept {}
5052

5153
template <seqan3::arithmetic score_arg_t>
52-
constexpr bisulfite_scoring_scheme(seqan3::match_score<score_arg_t> const ms,
53-
seqan3::mismatch_score<score_arg_t> const mms, bsDirection const dir = bsDirection::fwd)
54+
constexpr bisulfite_scoring_scheme(seqan3::match_score<score_arg_t> const ms,
55+
seqan3::mismatch_score<score_arg_t> const mms,
56+
bsDirection const dir = bsDirection::fwd)
5457
{
5558
set_bisulfite_scheme(ms, mms, dir);
5659
}
5760

5861
constexpr bisulfite_scoring_scheme(matrix_type const & _matrix) noexcept {}
5962

6063
template <seqan3::arithmetic score_arg_t>
61-
constexpr void set_bisulfite_scheme(seqan3::match_score<score_arg_t> const ms,
62-
seqan3::mismatch_score<score_arg_t> const mms, bsDirection const dir = bsDirection::fwd)
64+
constexpr void set_bisulfite_scheme(seqan3::match_score<score_arg_t> const ms,
65+
seqan3::mismatch_score<score_arg_t> const mms,
66+
bsDirection const dir = bsDirection::fwd)
6367
{
64-
std::conditional_t<std::integral<score_type>, int64_t, double> i_ms = static_cast<score_arg_t>(ms);
68+
std::conditional_t<std::integral<score_type>, int64_t, double> i_ms = static_cast<score_arg_t>(ms);
6569
std::conditional_t<std::integral<score_type>, int64_t, double> i_mms = static_cast<score_arg_t>(mms);
66-
if ((i_ms < std::numeric_limits<score_type>::lowest() || i_ms > std::numeric_limits<score_type>::max()) ||
70+
if ((i_ms < std::numeric_limits<score_type>::lowest() || i_ms > std::numeric_limits<score_type>::max()) ||
6771
(i_mms < std::numeric_limits<score_type>::lowest() || i_mms > std::numeric_limits<score_type>::max()))
6872
{
69-
throw std::invalid_argument{"You passed a score value to set_bisulfite_scheme that is out of range of the "
70-
"scoring scheme's underlying type. Define your scoring scheme with a larger "
71-
"template parameter or down-cast you score value beforehand to prevent "
72-
"this exception."};
73+
throw std::invalid_argument{
74+
"You passed a score value to set_bisulfite_scheme that is out of range of the "
75+
"scoring scheme's underlying type. Define your scoring scheme with a larger "
76+
"template parameter or down-cast you score value beforehand to prevent "
77+
"this exception."};
7378
}
7479

7580
// Assume query is horizontal sequence
@@ -85,27 +90,28 @@ class bisulfite_scoring_scheme : public seqan3::scoring_scheme_base<bisulfite_sc
8590
}
8691
};
8792

88-
bisulfite_scoring_scheme() -> bisulfite_scoring_scheme<int8_t>;
93+
bisulfite_scoring_scheme()->bisulfite_scoring_scheme<int8_t>;
8994

9095
template <seqan3::arithmetic score_arg_type>
91-
bisulfite_scoring_scheme(seqan3::match_score<score_arg_type>,
92-
seqan3::mismatch_score<score_arg_type>) -> bisulfite_scoring_scheme<int8_t>;
96+
bisulfite_scoring_scheme(seqan3::match_score<score_arg_type>, seqan3::mismatch_score<score_arg_type>)
97+
-> bisulfite_scoring_scheme<int8_t>;
9398

9499
template <seqan3::arithmetic score_arg_type>
95100
bisulfite_scoring_scheme(std::array<std::array<score_arg_type, 5>, 5>) -> bisulfite_scoring_scheme<score_arg_type>;
96101

97102
namespace seqan
98103
{
99104

100-
struct BisulfiteMatrix{};
105+
struct BisulfiteMatrix
106+
{};
101107

102108
template <>
103109
struct ScoringMatrixData_<int, Dna5, BisulfiteMatrix>
104110
{
105111
enum
106112
{
107113
VALUE_SIZE = ValueSize<Dna5>::VALUE,
108-
TAB_SIZE = VALUE_SIZE * VALUE_SIZE
114+
TAB_SIZE = VALUE_SIZE * VALUE_SIZE
109115
};
110116

111117
static inline int const * getData()
@@ -122,12 +128,13 @@ struct ScoringMatrixData_<int, Dna5, BisulfiteMatrix>
122128
// clang-format on
123129
return _data;
124130
}
125-
126131
};
127132

128133
template <typename T>
129-
inline void
130-
setScoreBisulfiteMatrix(Score<int, ScoreMatrix<Dna5, BisulfiteMatrix> > & sc, T matchScore, T mismatchScore, bsDirection const dir = bsDirection::fwd)
134+
inline void setScoreBisulfiteMatrix(Score<int, ScoreMatrix<Dna5, BisulfiteMatrix>> & sc,
135+
T matchScore,
136+
T mismatchScore,
137+
bsDirection const dir = bsDirection::fwd)
131138
{
132139
for (size_t i = 0; i < ValueSize<Dna5>::VALUE; ++i)
133140
{

src/evaluate_bisulfite_alignment.hpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,23 @@
2323
namespace seqan
2424
{
2525

26-
template <typename TSource0, typename TGapsSpec0,
27-
typename TSource1, typename TGapsSpec1,
28-
typename TScoreVal>
29-
TScoreVal computeAlignmentStats(AlignmentStats & stats,
30-
Gaps<TSource0, TGapsSpec0> const & row0,
31-
Gaps<TSource1, TGapsSpec1> const & row1,
26+
template <typename TSource0, typename TGapsSpec0, typename TSource1, typename TGapsSpec1, typename TScoreVal>
27+
TScoreVal computeAlignmentStats(AlignmentStats & stats,
28+
Gaps<TSource0, TGapsSpec0> const & row0,
29+
Gaps<TSource1, TGapsSpec1> const & row1,
3230
Score<TScoreVal, ScoreMatrix<Dna5, BisulfiteMatrix>> const & scoringScheme)
3331
{
3432
clear(stats);
3533

3634
typedef typename Iterator<Gaps<TSource0, TGapsSpec0> const, Standard>::Type TGapsIter0;
3735
typedef typename Iterator<Gaps<TSource1, TGapsSpec1> const, Standard>::Type TGapsIter1;
38-
typedef typename Value<TSource0>::Type TAlphabet;
36+
typedef typename Value<TSource0>::Type TAlphabet;
3937

4038
// Get iterators.
41-
TGapsIter0 it0 = begin(row0);
42-
TGapsIter0 itEnd0 = end(row0);
43-
TGapsIter1 it1 = begin(row1);
44-
TGapsIter1 itEnd1 = end(row1);
39+
TGapsIter0 it0 = begin(row0);
40+
TGapsIter0 itEnd0 = end(row0);
41+
TGapsIter1 it1 = begin(row1);
42+
TGapsIter1 itEnd1 = end(row1);
4543

4644
// State whether we have already opened a gap.
4745
bool isGapOpen0 = false, isGapOpen1 = false;
@@ -91,12 +89,12 @@ TScoreVal computeAlignmentStats(AlignmentStats & stats,
9189
if (!isGap(it0) && !isGap(it1))
9290
{
9391
// Compute the alignment score and register in stats.
94-
TAlphabet c0 = convert<TAlphabet>(*it0);
95-
TAlphabet c1 = convert<TAlphabet>(*it1);
92+
TAlphabet c0 = convert<TAlphabet>(*it0);
93+
TAlphabet c1 = convert<TAlphabet>(*it1);
9694
TScoreVal scoreVal = score(scoringScheme, c0, c1);
9795
stats.alignmentScore += scoreVal;
9896
// Register other statistics.
99-
bool isMatch = score(scoringScheme, c0, c1) == score(scoringScheme, c0, c0);
97+
bool isMatch = score(scoringScheme, c0, c1) == score(scoringScheme, c0, c0);
10098
bool isPositive = (scoreVal > 0);
10199
stats.numMatches += isMatch;
102100
stats.numMismatches += !isMatch;
@@ -111,10 +109,9 @@ TScoreVal computeAlignmentStats(AlignmentStats & stats,
111109

112110
// Finally, compute the alignment similarity from the various counts
113111
stats.alignmentLength = length(row0);
114-
stats.alignmentSimilarity = 100.0 * static_cast<float>(stats.numPositiveScores)
115-
/ static_cast<float>(stats.alignmentLength);
116-
stats.alignmentIdentity = 100.0 * static_cast<float>(stats.numMatches)
117-
/ static_cast<float>(stats.alignmentLength);
112+
stats.alignmentSimilarity =
113+
100.0 * static_cast<float>(stats.numPositiveScores) / static_cast<float>(stats.alignmentLength);
114+
stats.alignmentIdentity = 100.0 * static_cast<float>(stats.numMatches) / static_cast<float>(stats.alignmentLength);
118115

119116
return stats.alignmentScore;
120117
}

src/lambda.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
#include <seqan3/argument_parser/all.hpp>
2323

24-
#include "search.hpp"
2524
#include "mkindex.hpp"
25+
#include "search.hpp"
2626
#include "shared_options.hpp"
2727

2828
void parseCommandLineMain(int argc, char const ** argv);
@@ -32,7 +32,7 @@ int main(int argc, char const ** argv)
3232
if (std::string(CMAKE_BUILD_TYPE) != "Release")
3333
std::cerr << "WARNING: This binary is not built in release mode and will be much slower than it should be!\n";
3434

35-
int until = argc;
35+
int until = argc;
3636
bool skipNext = false;
3737
for (int i = 1; i < argc; ++i)
3838
{
@@ -45,7 +45,8 @@ int main(int argc, char const ** argv)
4545
if (skipNext)
4646
{
4747
skipNext = false;
48-
} else
48+
}
49+
else
4950
{
5051
until = i + 1;
5152
break;
@@ -71,7 +72,7 @@ int main(int argc, char const ** argv)
7172
}
7273
else if ((std::string(argv[until]) == "mkindexp") || (std::string(argv[until]) == "mkindexn"))
7374
{
74-
return mkindexMain(argc - until, argv + until);
75+
return mkindexMain(argc - until, argv + until);
7576
}
7677
else
7778
{
@@ -92,15 +93,18 @@ void parseCommandLineMain(int argc, char const ** argv)
9293
sharedSetup(parser);
9394

9495
std::string command{};
95-
parser.add_positional_option(command, "The sub-program to execute. See below.",
96-
seqan3::value_list_validator{"searchp", "searchn", "mkindexp", "mkindexn"});
96+
parser.add_positional_option(command,
97+
"The sub-program to execute. See below.",
98+
seqan3::value_list_validator{"searchp", "searchn", "mkindexp", "mkindexn"});
9799

98100
parser.info.description.push_back("Available commands");
99-
parser.info.description.push_back("\\fBsearchp \\fP– Perform a protein search (BLASTP, BLASTX, TBLASTN, TBLASTX).");
101+
parser.info.description.push_back(
102+
"\\fBsearchp \\fP– Perform a protein search (BLASTP, BLASTX, TBLASTN, TBLASTX).");
100103
parser.info.description.push_back("\\fBsearchn \\fP– Perform a nucleotide search (BLASTN, MEGABLAST).");
101104
parser.info.description.push_back("\\fBmkindexp \\fP– Create an index for protein searches.");
102105
parser.info.description.push_back("\\fBmkindexn \\fP– Create an index for nucleotide searches.");
103-
parser.info.description.push_back("To view the help page for a specific command, simply run 'lambda command --help'.");
106+
parser.info.description.push_back(
107+
"To view the help page for a specific command, simply run 'lambda command --help'.");
104108

105109
parser.parse();
106110
}

0 commit comments

Comments
 (0)