ʻOhana
Population structure, admixture history, and selection using learning methods.
Data Structures | Public Types | Public Member Functions
jade::basic_selscan< TValue > Class Template Reference

A template for a class implementing the selscan program. More...

#include <jade.selscan.hpp>

+ Collaboration diagram for jade::basic_selscan< TValue >:

Public Types

typedef TValue value_type
 The value type. More...
 
typedef basic_matrix< value_typematrix_type
 The matrix type. More...
 
typedef basic_verification< value_typeverification_type
 The verification type. More...
 
typedef basic_genotype_matrix< value_typegenotype_matrix_type
 The genotype matrix type. More...
 
typedef basic_genotype_matrix_factory< TValue > genotype_matrix_factory_type
 The genotype matrix factory type. More...
 

Public Member Functions

 basic_selscan (args &a)
 Initializes a new instance of the class. More...
 
void execute ()
 Executes the program. More...
 

Detailed Description

template<typename TValue>
class jade::basic_selscan< TValue >

A template for a class implementing the selscan program.

Definition at line 19 of file jade.selscan.hpp.

Member Typedef Documentation

◆ genotype_matrix_factory_type

template<typename TValue >
typedef basic_genotype_matrix_factory<TValue> jade::basic_selscan< TValue >::genotype_matrix_factory_type

The genotype matrix factory type.

Definition at line 37 of file jade.selscan.hpp.

◆ genotype_matrix_type

template<typename TValue >
typedef basic_genotype_matrix<value_type> jade::basic_selscan< TValue >::genotype_matrix_type

The genotype matrix type.

Definition at line 32 of file jade.selscan.hpp.

◆ matrix_type

template<typename TValue >
typedef basic_matrix<value_type> jade::basic_selscan< TValue >::matrix_type

The matrix type.

Definition at line 26 of file jade.selscan.hpp.

◆ value_type

template<typename TValue >
typedef TValue jade::basic_selscan< TValue >::value_type

The value type.

Definition at line 23 of file jade.selscan.hpp.

◆ verification_type

template<typename TValue >
typedef basic_verification<value_type> jade::basic_selscan< TValue >::verification_type

The verification type.

Definition at line 29 of file jade.selscan.hpp.

Constructor & Destructor Documentation

◆ basic_selscan()

template<typename TValue >
jade::basic_selscan< TValue >::basic_selscan ( args a)
inlineexplicit

Initializes a new instance of the class.

Parameters
aThe command-line arguments.

Definition at line 42 of file jade.selscan.hpp.

44  : steps (a.read("--steps", "-s", size_t(100)))
45  , f_epsilon (_read_f_epsilon(a))
46  , g_ptr (genotype_matrix_factory_type::create(a.pop<std::string>()))
47  , g (*g_ptr)
48  , fa (a.pop<std::string>())
49  , c1 (a.pop<std::string>())
50  , c2 (_init_scaling_matrix(a, c1))
51  , RK (c1.get_width())
52  , J (g.get_width())
53  , mu (g.create_mu(f_epsilon))
54  , rooted_fa (_compute_rooted_fa(fa))
55  , c_inv (RK, RK)
56  , f_j_c_inv (RK, 1)
57  {
58  if (steps < 2)
59  throw error() << "invalid value for --steps option ("
60  << steps << "); expected at least two steps";
61 
62  a.validate_empty();
63 
71  }
+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

template<typename TValue >
void jade::basic_selscan< TValue >::execute ( )
inline

Executes the program.

Definition at line 76 of file jade.selscan.hpp.

77  {
78  const auto K = fa.get_height();
79 
80  std::cout << "step\tlle-ratio\tglobal-lle\tlocal-lle";
81 
82  for (size_t k = 0; k < K; k++)
83  std::cout << "\t" << "f-pop" << k;
84 
85  std::cout << std::endl;
86 
87  std::vector<record> records;
88  records.reserve(J);
89  for (size_t j = 0; j < J; j++)
90  records.emplace_back(j, _compute_score(0, j));
91 
92  for (size_t si = 0; si < steps; si++)
93  for (auto & r : records)
94  r.update(si, _compute_score(si, r.get_j()));
95 
96  for (const auto & r : records)
97  {
98  std::cout << r.get_step() << '\t'
99  << _format(r.get_lle_ratio()) << '\t'
100  << _format(r.get_score()) << '\t'
101  << _format(r.get_best_score());
102 
103  for (size_t k = 0; k < K; k++)
104  std::cout << '\t' << _format(fa(k, r.get_j()));
105 
106  std::cout << std::endl;
107  }
108  }
+ Here is the call graph for this function:

The documentation for this class was generated from the following file:
jade::basic_verification::validate_c
static bool validate_c(const matrix_type &c)
Validates the C matrix and throws an exception if validation fails.
Definition: jade.verification.hpp:38
jade::basic_genotype_matrix_factory::create
static genotype_matrix_type * create(const std::string &path)
Creates a genotype matrix based on values from a file. This function determines what kind of genotype...
Definition: jade.genotype_matrix_factory.hpp:48
jade::basic_verification::validate_gf_sizes
static bool validate_gf_sizes(const genotype_matrix_type &g, const matrix_type &f)
Validates the sizes of the G and F matrices and throws an exception if validation fails.
Definition: jade.verification.hpp:177
jade::basic_matrix::get_width
size_t get_width() const
Definition: jade.matrix.hpp:757
jade::basic_verification::validate_fc_sizes
static bool validate_fc_sizes(const matrix_type &f, const matrix_type &c)
Validates the sizes of the F and C matrices and throws an exception if validation fails.
Definition: jade.verification.hpp:114
jade::basic_genotype_matrix::get_width
virtual size_t get_width() const =0
jade::basic_genotype_matrix::create_mu
virtual matrix_type create_mu(const value_type f_epsilon) const =0
jade::basic_verification::validate_f
static bool validate_f(const matrix_type &f)
Validates the F matrix and throws an exception if validation fails.
Definition: jade.verification.hpp:73
jade::basic_matrix::get_height
size_t get_height() const
Definition: jade.matrix.hpp:603
jade::basic_verification::validate_g
static bool validate_g(const genotype_matrix_type &g)
Validates the G matrix and throws an exception if validation fails.
Definition: jade.verification.hpp:158