25 unsigned int n = TextTools::fromString<unsigned int>(s);
26 auto dist = make_unique<DistanceMatrix>(n);
27 unsigned int rowNumber = 0;
28 unsigned int colNumber = 0;
36 size_t pos = s.find(
" ");
37 if (pos == string::npos)
38 throw Exception(
"PhylipDistanceMatrixFormat::read. Bad format, probably not 'extended' Phylip.");
39 dist->setName(rowNumber, s.substr(0, pos));
40 s = s.substr(pos + 2);
44 dist->setName(rowNumber, s.substr(0, 10));
51 double d = TextTools::fromString<double>(st.
nextToken());
52 (*dist)(rowNumber, colNumber) = d;
66 size_t n = dist.
size();
67 out <<
" " << n << endl;
72 for (
size_t i = 0; i < n; ++i)
74 size_t s = dist.
getName(i).size();
79 for (
unsigned int i = 0; i < n; i++)
90 for (
unsigned int j = 0; j < n; j++)
94 out << setprecision(8) << dist(i, j);
A Matrix class to store phylogenetic distances.
const std::string & getName(std::size_t i) const
const std::string & nextToken()
bool hasMoreToken() const
std::string resizeRight(const std::string &s, std::size_t newSize, char fill)
This alphabet is used to deal NumericAlphabet.