Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 7cb0c4b

Browse files
committed
Merge branch 'dev'
2 parents 4e20956 + e19cebd commit 7cb0c4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2522
-2504
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ addons:
1515
- clang
1616
- zlib1g
1717
- zlib1g-dev
18+
- libboost-dev
19+
- libboost-system-dev
20+
- libboost-test-dev
1821

1922
notifications:
2023
email: false

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Comments are welcome.
2222

2323
- Kevin Thornton <krthornt@uci.edu>
2424

25+
# User's group
26+
27+
Please post to the [libsequence user group](https://groups.google.com/forum/#!forum/libsequence-users) for help.
28+
2529
# Build status
2630

2731
* master branch: [![Build Status](https://travis-ci.org/molpopgen/libsequence.svg?branch=master)](https://travis-ci.org/molpopgen/libsequence)

REVISION_HISTORY.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ However:
3030

3131
1. Sequence/SeqRegexes.hpp -- not working. This will not be fixed until GCC supports <regex>. The function is now currently implemented in a non-regex manner, which is lame, but it works.
3232

33+
## libsequence 1.8.9
34+
35+
Major API and ABI changes! This release is a __big__ step towards a "2.0"-style release.
36+
37+
* Issue #8 fixed
38+
* Sequence::PolyTableSlice will throw std::runtime_error if input range is not properly sorted
39+
* War on "mutable". The use of this keyword has been removed from the library to the best extent possible.
40+
* The API for calculations involving codons has been modernized. This includes Sequence::Comeron95, Sequence::RedundancyCom95, Sequence::WeightingScheme2 (and derived types), Sequence::WeightingScheme3 (and derived types), Sequence::TwoSubs, Sequence::ThreeSubs, functions in Sequence/PathwayHelper.hpp
41+
* Sequence::PolyTable (and derived types) have been refactored. The fundamental idea is the same, but the API is modernized. IMO, it is still imperfect, and can be further changed to reflect more idiomatic C++11, but that'll have to wait.
42+
* Private data members for classes have been hidden using the [PIMPL idiom](https://en.wikipedia.org/wiki/Opaque_pointer). This goes a long way to future-proofing the ABI compatibility of these types against further implementation changes such as bug fixes.
43+
* Sequence/SummStats/classic.hpp provides a sneak previous of how summary statistics will work in the future, once the deprecated Sequence::PolySNP and Sequence::PolySIM can finally be removed
44+
3345
## libsequence 1.8.8
3446

3547
* l-HAF statistic added (Sequence/SummStats/lHaf.hpp)

Sequence/Coalescent/SimTypes.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ namespace Sequence
173173
The sample size being simulated. The 2*nsam-1 nodes
174174
in the tree are therefore indexed from 0 to 2*nsam-2
175175
*/
176-
mutable int nsam;
176+
const int nsam;
177177
/*!
178178
The current number of nodes in the tree. By current, it
179179
is meant the current time in the simulation. At the start

Sequence/Comeron95.hpp

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -113,62 +113,31 @@ long with libsequence. If not, see <http://www.gnu.org/licenses/>.
113113

114114
/*! \example gestimator.cc
115115
*/
116+
#include <Sequence/WeightingSchemes.hpp>
116117
#include <Sequence/SeqEnums.hpp>
118+
#include <Sequence/Seq.hpp>
119+
#include <array>
117120

118121
namespace Sequence
119122
{
120-
class Seq;
121-
class Sites;
122-
class RedundancyCom95;
123-
class WeightingScheme2;
124-
class WeightingScheme3;
123+
using Com95_t = std::array<double,19>;
125124
class Comeron95
126125
{
127126
private:
128-
bool __2wasNULL,__3wasNULL,__red_was_NULL;
129-
WeightingScheme2 *weights2;
130-
WeightingScheme3 *weights3;
131-
int valid, maxhits, genetic_code, weighting_scheme;
132-
//see Comeron '95 for a discussion of the method--will document later
133-
double Qs, Bs, Qa, Ba, A2S, A4, As, A2V, A0, Aa;
134-
double q0, q2S, q2V, q4, p0, p2S, p2V, p4;
135-
Sites *sites;
136-
const RedundancyCom95 *sitesObj;
137-
void diverge (const Sequence::Seq * seq1, const Sequence::Seq * seq2,
138-
WeightingScheme2 *_weights2,
139-
WeightingScheme3 *_weights3);
140-
void omega (const Sequence::Seq * seqobj1, const Sequence::Seq * seqobj2);
141-
double Ka, Ks;
127+
struct Com95impl;
128+
std::unique_ptr<Com95impl> impl;
142129
public:
143-
explicit Comeron95 (const Sequence::Seq * seqa,
144-
const Sequence::Seq * seqb,
145-
int max = 3,
146-
const Sequence::RedundancyCom95 * genetic_code_redundancy = NULL,
147-
GeneticCodes code = GeneticCodes::UNIVERSAL,
148-
WeightingScheme2 *weights2 = NULL,
149-
WeightingScheme3 *weights3 = NULL);
130+
explicit Comeron95( GeneticCodes code = GeneticCodes::UNIVERSAL );
150131
Comeron95( const Comeron95 & ) = delete;
151132
Comeron95 & operator=(const Comeron95 & ) = delete;
152-
~Comeron95 (void);
153-
double ka (void) const;
154-
double ks (void) const;
155-
double ratio (void) const;
156-
double P0 (void) const;
157-
double P2S (void) const;
158-
double P2V (void) const;
159-
double P4 (void) const;
160-
double Q0 (void) const;
161-
double Q2S (void) const;
162-
double Q2V (void) const;
163-
double Q4 (void) const;
164-
double as (void) const;
165-
double aa (void) const;
166-
double bs (void) const;
167-
double ba (void) const;
168-
double L0 (void) const;
169-
double L2S (void) const;
170-
double L2V (void) const;
171-
double L4 (void) const;
133+
Com95_t operator()(const Sequence::Seq & seqa,
134+
const Sequence::Seq & seqb,
135+
int maxdiffs = 3);
136+
Com95_t operator()(const Sequence::Seq & seqa,
137+
const Sequence::Seq & seqb,
138+
const WeightingScheme2 *weights2,
139+
const WeightingScheme3 *weights3,
140+
int maxdiffs = 3);
172141
};
173142
}
174143

Sequence/FST.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ long with libsequence. If not, see <http://www.gnu.org/licenses/>.
3232

3333
/*! \file FST.hpp
3434
@brief delcaration of a class (Sequence::FST) to analyze population structure
35+
36+
\deprecated Will be removed in libsequence 2.0
3537
*/
3638
namespace Sequence
3739
{
@@ -40,8 +42,7 @@ namespace Sequence
4042
class FST
4143
{
4244
private:
43-
void doCalcs(void) const;
44-
mutable std::unique_ptr<FSTimpl> impl;
45+
std::unique_ptr<FSTimpl> impl;
4546
public:
4647
explicit FST(const PolyTable *data, unsigned npop, const unsigned *config=NULL,
4748
const double *weights=NULL, bool haveOutgroup = false,

Sequence/GranthamWeights.hpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,14 @@ long with libsequence. If not, see <http://www.gnu.org/licenses/>.
4646
namespace Sequence
4747
{
4848
class Grantham;
49-
class GranthamWeights2 : public WeightingScheme2
49+
struct GranthamWeights2 : public WeightingScheme2
5050
{
51-
private:
52-
Sequence::GeneticCodes code;
53-
mutable double __weights[2];//logical const
54-
public:
55-
explicit GranthamWeights2(Sequence::GeneticCodes genetic_code = GeneticCodes::UNIVERSAL);
56-
~GranthamWeights2(void);
57-
void Calculate(const std::string &codon1, const std::string &codon2) const;
58-
double *weights(void) const;
51+
weights2_t operator()(const std::string &codon1, const std::string &codon2,Sequence::GeneticCodes genetic_code) const;
5952
};
6053

61-
class GranthamWeights3 : public WeightingScheme3
54+
struct GranthamWeights3 : public WeightingScheme3
6255
{
63-
private:
64-
GeneticCodes code;
65-
mutable double __weights[6];//logical const
66-
public:
67-
explicit GranthamWeights3(Sequence::GeneticCodes genetic_code = GeneticCodes::UNIVERSAL);
68-
~GranthamWeights3(void);
69-
void Calculate(const std::string &codon1, const std::string &codon2) const;
70-
double *weights(void) const;
56+
weights3_t operator()(const std::string &codon1, const std::string &codon2,Sequence::GeneticCodes genetic_code) const;
7157
};
7258
}
7359
#endif

Sequence/HKA.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ namespace Sequence
4242
SA is the number of polymorphic sites in species A,
4343
SB is the same quantity for species B
4444
*/
45-
mutable unsigned SA,SB; //# seg sites
45+
const unsigned SA,SB; //# seg sites
4646
/*!
4747
D is a measure of divergence between species A and B,
4848
i.e. mean pairwise differences
4949
*/
50-
mutable double D; // divergence
50+
const double D; // divergence
5151
/*!
5252
The sample sizes in species A and B
5353
*/
54-
mutable unsigned nA,nB; //sample sizes
54+
const unsigned nA,nB; //sample sizes
5555
HKAdata();
5656
HKAdata(const HKAdata & d);
5757
HKAdata(unsigned sa,unsigned sb,double d,

Sequence/PathwayHelper.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ long with libsequence. If not, see <http://www.gnu.org/licenses/>.
3333
or the intermedate codons that occurs between two different codons
3434
*/
3535
#include <string>
36-
36+
#include <array>
3737
namespace Sequence
3838
{
39-
void Intermediates2(std::string *intermediates,const std::string &codon1, const std::string &codon2);
40-
void Intermediates3(std::string *intermediates, const std::string &codon1, const std::string &codon2);
39+
using Inter2_t = std::array<std::string,2>;
40+
using Inter3_t = std::array<std::string,9>;
41+
Inter2_t Intermediates2(const std::string &codon1, const std::string &codon2);
42+
Inter3_t Intermediates3(const std::string &codon1, const std::string &codon2);
4143
}
4244
#endif
4345

Sequence/PolySIM.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ long with libsequence. If not, see <http://www.gnu.org/licenses/>.
3535
that outgroup information is not required, as the 0,1 coding of a
3636
SimData object (usually) reflects ancestral and derived.
3737
@short Analysis of coalescent simulation data
38+
39+
\deprecated Will be removed in libsequence 2.0
3840
*/
3941
#include <Sequence/PolySNP.hpp>
4042

0 commit comments

Comments
 (0)