44 #include <Bpp/Seq/SiteTools.h> 45 #include <Bpp/Seq/Container/VectorSiteContainer.h> 53 names_(sequences->getSequencesNames()),
57 sequences_(sequences),
58 alpha_(sequences->getAlphabet()),
61 size_t nbSites = sequences->getNumberOfSites();
62 vector<SortableSite> ss(nbSites);
63 for (
size_t i = 0; i < nbSites; i++)
65 const Site* currentSite = &sequences->getSite(i);
67 ssi->
siteS = currentSite->toString();
68 ssi->
siteP = currentSite;
75 sort(ss.begin(), ss.end());
80 const Site* previousSite = ss0->siteP;
83 sites_.push_back(previousSite);
86 unsigned int currentPos = 0;
87 for (
unsigned int i = 1; i < nbSites; i++)
90 const Site* currentSite = ssi->
siteP;
91 bool siteExists = SiteTools::areSitesIdentical(*currentSite, *previousSite);
98 sites_.push_back(currentSite);
103 previousSite = currentSite;
112 SiteContainer* sites =
new VectorSiteContainer(
sites_,
alpha_);
113 sites->setSequencesNames(
names_,
false);
SitePatterns(const SiteContainer *sequences, bool own=false)
Build a new SitePattern object.
std::vector< const Site * > sites_
std::vector< size_t > indices_
std::vector< std::string > names_
Class used for site pattern sorting.
std::vector< unsigned int > weights_
Class used for site pattern sorting.
SiteContainer * getSites() const