1 #ifndef FAIF_HAPL_LOCI_HPP 2 #define FAIF_HAPL_LOCI_HPP 6 #include <boost/lexical_cast.hpp> 8 #include "../Value.hpp" 16 struct AlleleImpl :
public std::pair<std::string, bool> {
19 AlleleImpl(
const std::string& name = std::string(
""),
bool is_silent =
false)
20 :
std::pair<
std::string,bool>(name, is_silent) {}
24 return first == a.first;
29 return first != a.first;
45 inline std::string
getName(
const Allele& a) {
51 return a.
get().second;
60 std::string generateAlleleName(
const std::string& locus_name,
int allele_number) {
61 return locus_name + boost::lexical_cast<std::string>(allele_number);
71 Locus
createLocus(
const std::string& name,
int num_variants,
bool has_silent) {
79 for(num = 1; num < num_variants; num++) {
91 typedef std::vector<Locus>
Loci;
94 inline std::ostream&
operator<<(std::ostream& os,
const Loci& loci) {
95 std::copy(loci.begin(), loci.end(), std::ostream_iterator<Locus>(os,
";") );
102 #endif //FAIF_HAPL_LOCI_HPP DomainEnumerate< Allele > Locus
Locus, place on DNA contatining the Allele.
Definition: Loci.hpp:55
bool operator==(const AlleleImpl &a) const
equality comparison
Definition: Loci.hpp:23
Locus createLocus(const std::string &name, int num_variants, bool has_silent)
helping method - create the entire locus, with number variants.
Definition: Loci.hpp:71
std::ostream & operator<<(std::ostream &os, const AlleleImpl &a)
ostream operator
Definition: Loci.hpp:34
Value & get()
accessor
Definition: Value.hpp:99
ValueNominal< AlleleImpl > Allele
Allele, variant of a gene.
Definition: Loci.hpp:42
std::string getName(const Allele &a)
accessor
Definition: Loci.hpp:45
forward declaration
Definition: Value.hpp:60
the helping structure, implements the Allele members
Definition: Loci.hpp:16
bool isSilent(const Allele &a)
accessor
Definition: Loci.hpp:50
AlleleImpl(const std::string &name=std::string(""), bool is_silent=false)
c-tor
Definition: Loci.hpp:19
ValueId insert(const typename Val::Value &value)
search for value equal to given, if found return the value identifier, otherwise insert new into coll...
Definition: Value.hpp:310
std::vector< Locus > Loci
Loci, the collection(sequence) of Locus, e.g. genotype.
Definition: Loci.hpp:91
nominal attribute template (equality comparable)
Definition: Value.hpp:65
bool operator!=(const AlleleImpl &a) const
non-equality comparison
Definition: Loci.hpp:28