Skip to content

Commit d830c79

Browse files
committed
move annotation strings backward behind the branch lengths to make it consistent with IQ-TREE
1 parent 7ddd439 commit d830c79

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tree/phylonode.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const std::string cmaple::PhyloNode::exportString(
229229
std::vector<NumSeqsType>& less_info_seqs = getLessInfoSeqs();
230230
const std::vector<NumSeqsType>::size_type num_less_info_seqs = less_info_seqs.size();
231231
if (num_less_info_seqs == 0) {
232-
return seq_names[getSeqNameIndex()] + annotation_str + ":" + length_str;
232+
return seq_names[getSeqNameIndex()] + ":" + length_str + annotation_str;
233233
// with minor sequences -> return minor sequences' names with zero
234234
// branch lengths
235235
} else {
@@ -246,27 +246,27 @@ const std::string cmaple::PhyloNode::exportString(
246246
// export less informative sequences in binary tree format
247247
if (binary) {
248248
output.resize(num_less_info_seqs, '(');
249-
output += seq_name + sprta_less_info;
249+
output += seq_name;
250250

251251
// add the first less-info-seq
252-
output += ":0," + seq_names[less_info_seqs[0]] + sprta_less_info + ":0)";
252+
output += ":0" + sprta_less_info + "," + seq_names[less_info_seqs[0]] + ":0" + sprta_less_info + ")";
253253

254254
// add the remaining less-info-seqs
255255
for (std::vector<NumSeqsType>::size_type i = 1; i < less_info_seqs.size(); ++i) {
256-
output += branch_support + ":0," + seq_names[less_info_seqs[i]] + sprta_less_info + ":0)";
256+
output += branch_support + ":0," + seq_names[less_info_seqs[i]] + ":0" + sprta_less_info + ")";
257257
}
258258

259-
output += internal_name + branch_support + annotation_str + ":" + length_str;
259+
output += internal_name + branch_support + ":" + length_str + annotation_str;
260260
}
261261
// export less informative sequences in mutifurcating tree format
262262
else {
263-
output = "(" + seq_name + sprta_less_info + ":0";
263+
output = "(" + seq_name + ":0" + sprta_less_info;
264264

265265
for (auto minor_seq_name_index : less_info_seqs) {
266-
output += "," + seq_names[minor_seq_name_index] + sprta_less_info + ":0";
266+
output += "," + seq_names[minor_seq_name_index] + ":0" + sprta_less_info;
267267
}
268268

269-
output += ")" + internal_name + branch_support + annotation_str + ":" + length_str;
269+
output += ")" + internal_name + branch_support + ":" + length_str + annotation_str;
270270
}
271271
return output;
272272
}

tree/tree.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ std::string cmaple::Tree::exportNodeString(const bool is_newick_format,
15581558
string length = node.getUpperLength() <= 0
15591559
? "0"
15601560
: convertDoubleToString(node.getUpperLength(), 12);
1561-
output += ")" + internal_name + branch_support + annotation_str + ":" + length;
1561+
output += ")" + internal_name + branch_support + ":" + length + annotation_str;
15621562

15631563
return output;
15641564
}

0 commit comments

Comments
 (0)