Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit abe9ea7

Browse files
committed
New option --date-outlier for -e option in LSD2
1 parent 408264a commit abe9ea7

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

main/timetree.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ void runLSD2(PhyloTree *tree) {
237237
arg.push_back(convertDoubleToString(Params::getInstance().clock_stddev));
238238
}
239239
}
240+
241+
if (Params::getInstance().date_outlier >= 0) {
242+
arg.push_back("-e");
243+
arg.push_back(convertIntToString(Params::getInstance().date_outlier));
244+
}
240245

241246
if (Params::getInstance().root) {
242247
// print outgroup file for LSD

utils/tools.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,7 @@ void parseArg(int argc, char *argv[], Params &params) {
11211121
params.date_debug = false;
11221122
params.date_replicates = 0;
11231123
params.clock_stddev = -1.0;
1124+
params.date_outlier = -1.0;
11241125

11251126
params.matrix_exp_technique = MET_EIGEN3LIB_DECOMPOSITION;
11261127

@@ -4118,6 +4119,16 @@ void parseArg(int argc, char *argv[], Params &params) {
41184119
continue;
41194120
}
41204121

4122+
if (strcmp(argv[cnt], "--date-outlier") == 0) {
4123+
cnt++;
4124+
if (cnt >= argc)
4125+
throw "Use --date-outlier <z_score_for_removing_outlier_nodes>";
4126+
params.date_outlier = convert_double(argv[cnt]);
4127+
if (params.date_outlier < 0)
4128+
throw "--date-outlier must be non-negative";
4129+
continue;
4130+
}
4131+
41214132
if (strcmp(argv[cnt], "--date-debug") == 0) {
41224133
params.date_debug = true;
41234134
continue;
@@ -4582,6 +4593,7 @@ void usage_iqtree(char* argv[], bool full_command) {
45824593
<< " --date-ci NUM Number of replicates to compute confidence interval" << endl
45834594
<< " --clock-sd NUM Std-dev for lognormal relaxed clock (default: 0.2)" << endl
45844595
<< " --date-outgroup Include outgroup in time tree (default: no)" << endl
4596+
<< " --date-outlier NUM Z-score cutoff to exclude outlier nodes (e.g. 3)" << endl
45854597
<< " --date-options \"..\" Extra options passing directly to LSD2" << endl
45864598
<< " --dating STRING Dating method: LSD for least square dating (default)" << endl
45874599
#endif

utils/tools.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,9 @@ class Params {
22032203

22042204
/** standard deviation of lognormal relaxed clock model for confidence interval estimate */
22052205
double clock_stddev;
2206+
2207+
/** z-score for detecting outlier nodes */
2208+
double date_outlier;
22062209
};
22072210

22082211
/**

0 commit comments

Comments
 (0)