Skip to content

Commit

Permalink
variance_min > 0 => indiscernibles are used, otherwise max_degree is …
Browse files Browse the repository at this point in the history
…very large
  • Loading branch information
vbrover committed Jun 21, 2020
1 parent 6dcb463 commit f141589
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 46 deletions.
22 changes: 22 additions & 0 deletions phylogeny/data/Salmonella-var_min.deformation_outliers
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
SAMN02844477
SAMN03475395
SAMN05605405
SAMN02844313
SAMN03002022
SAMN03478846
SAMN04485948
SAMN04535377
SAMN02368790
SAMN04308849
SAMN03474009
SAMN02699690
SAMN05201703
SAMN02640780
SAMN02843948
SAMN03838256.r2
SAMN04102293.r2
SAMN04363882
SAMN03892264
SAMN03154403
SAMN02645767
SAMN04507552
46 changes: 25 additions & 21 deletions phylogeny/data/Salmonella-var_min.distTree
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,66 @@ Neighbor joining ...

INPUT:
# Leaves: 291
# Discernible leaves: 291
# Discernible leaves: 285
# Nodes: 580
# Dissimilarities: 42195 (100.00 %)
Dissimilarities factor: 25.56
Ave. dissimilarity = 0.191845
Abs. criterion = 1.8111e+01 Rel. criterion = 2.951 %
Dissimilarities factor: 26.19
Ave. dissimilarity = 0.197058
Abs. criterion = 1.8217e+01 Rel. criterion = 2.959 %

Optimizing arc lengths for the whole tree ...
Optimizing arc lengths at each arc ...
# Nodes deleted = 17
Optimizing arc lengths at each node ...
# Nodes deleted = 4
Abs. criterion = 7.2358e+00 Rel. criterion = 1.865 %
# Nodes deleted = 2
Abs. criterion = 7.2835e+00 Rel. criterion = 1.871 %

Optimizing topology: subgraphs ...
# Hybrids: 0
Abs. criterion = 6.5163e+00 Rel. criterion = 1.763 %
Abs. criterion = 6.5364e+00 Rel. criterion = 1.766 %

# Hybrids: 0
Abs. criterion = 6.3905e+00 Rel. criterion = 1.746 %
Abs. criterion = 6.5128e+00 Rel. criterion = 1.763 %

# Hybrids: 0
Abs. criterion = 6.2287e+00 Rel. criterion = 1.724 %
Abs. criterion = 6.5049e+00 Rel. criterion = 1.762 %

# Hybrids: 0
Abs. criterion = 6.2112e+00 Rel. criterion = 1.722 %
Abs. criterion = 6.5035e+00 Rel. criterion = 1.761 %

# Hybrids: 0
Abs. criterion = 6.2088e+00 Rel. criterion = 1.721 %
Abs. criterion = 6.5029e+00 Rel. criterion = 1.761 %

# Hybrids: 0
Abs. criterion = 6.2084e+00 Rel. criterion = 1.721 %
Abs. criterion = 6.5025e+00 Rel. criterion = 1.761 %

# Hybrids: 0
Abs. criterion = 6.2082e+00 Rel. criterion = 1.721 %
Abs. criterion = 6.5023e+00 Rel. criterion = 1.761 %

# Hybrids: 0
Abs. criterion = 6.2081e+00 Rel. criterion = 1.721 %
Abs. criterion = 6.5021e+00 Rel. criterion = 1.761 %

# Hybrids: 0
Abs. criterion = 6.2081e+00 Rel. criterion = 1.721 %
Abs. criterion = 6.5020e+00 Rel. criterion = 1.761 %

# Iterations of subgraph optimization: 9
Abs. criterion = 6.2081e+00 Rel. criterion = 1.721 %
# Hybrids: 0
Abs. criterion = 6.5020e+00 Rel. criterion = 1.761 %

# Iterations of subgraph optimization: 10
Abs. criterion = 6.5019e+00 Rel. criterion = 1.761 %

Ave. radius: 0.456

# Criterion outliers: 4
Abs. criterion = 4.8597e+00 Rel. criterion = 1.542 %
Abs. criterion = 4.8721e+00 Rel. criterion = 1.543 %

# Deformation outliers: 0
# Deformation outliers: 22
Abs. criterion = 3.6261e+00 Rel. criterion = 1.447 %

OUTPUT:
Abs. criterion = 4.8597e+00 Rel. criterion = 1.542 %
Abs. criterion = 3.6261e+00 Rel. criterion = 1.447 %

Relative epsilon2_0 = 0.00 %
Mean residual = 0.00
Correlation between residual^2 and dissimilarity = 0.09
Correlation between residual^2 and dissimilarity = 0.12

2 changes: 1 addition & 1 deletion phylogeny/data/tree4.stat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Tree length = 15.000
Min. discernible leaf length = 1.000000e+00
Ave. arc length = 2.500
Interior height = 1
Height ignoring indiscernibles = 1
Bifurcating interior branching = 2.000
Max. degree = 3
# Frequent children interior nodes = 3
Expand Down
40 changes: 20 additions & 20 deletions phylogeny/distTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ void DTNode::qc () const
QC_ASSERT ((bool) getParent () == ! isNan (len));
if (! childrenDiscernible ())
{
QC_ASSERT (! DistTree_sp::variance_min);
//QC_ASSERT (! DistTree_sp::variance_min);
QC_ASSERT (! inDiscernible ());
for (const DiGraph::Arc* arc : arcs [false])
QC_ASSERT (static_cast <const DTNode*> (arc->node [false]) -> inDiscernible ());
Expand Down Expand Up @@ -665,7 +665,7 @@ const Leaf* DTNode::inDiscernible () const
return nullptr;
else
{
ASSERT (! DistTree_sp::variance_min);
//ASSERT (! DistTree_sp::variance_min);
return g;
}
else
Expand Down Expand Up @@ -1313,7 +1313,7 @@ void Leaf::qc () const

QC_ASSERT (! name. empty());
QC_ASSERT (! isLeft (name, "0x"));
QC_IMPLY (DistTree_sp::variance_min, discernible);
//QC_IMPLY (DistTree_sp::variance_min, discernible);
if (! isNan (len) && ! discernible && len)
{
cout << getName () << " " << len << endl;
Expand Down Expand Up @@ -1375,7 +1375,7 @@ void Leaf::collapse (Leaf* other)
{
ASSERT (! getDistTree (). subDepth);
ASSERT (this != other);
ASSERT (! DistTree_sp::variance_min);
//ASSERT (! DistTree_sp::variance_min);
//ASSERT (len == 0.0);
//ASSERT (discernible);

Expand Down Expand Up @@ -1608,8 +1608,8 @@ void Subgraph::removeIndiscernibles ()
{
ASSERT (! area. empty ());

if (DistTree_sp::variance_min)
return;
//if (DistTree_sp::variance_min)
//return;

for (Iter<VectorPtr<Tree::TreeNode>> iter (area); iter. next (); )
if (static_cast <const DTNode*> (*iter) -> inDiscernible ())
Expand Down Expand Up @@ -2888,8 +2888,8 @@ struct DissimLine
return;
if (! leaf2)
return;
if ( ! DistTree_sp::variance_min
&& ! dissim
if ( /*! DistTree_sp::variance_min
&&*/ ! dissim
&& ! leaf1->getCollapsed (leaf2) // Only for new Leaf's
)
leaf1->collapse (leaf2);
Expand Down Expand Up @@ -3882,7 +3882,7 @@ bool DistTree::loadLines (const StringVector &lines,
{
ASSERT (parent);
auto leaf = new Leaf (*this, parent, len, idS);
leaf->discernible = DistTree_sp::variance_min || ! indiscernible;
leaf->discernible = /*DistTree_sp::variance_min ||*/ ! indiscernible;
leaf->normCriterion = normCriterion;
dtNode = leaf;
}
Expand Down Expand Up @@ -4191,8 +4191,8 @@ LeafCluster DistTree::getIndiscernibles ()
ASSERT (! subDepth);
ASSERT (optimizable ());

if (DistTree_sp::variance_min)
return LeafCluster ();
//if (DistTree_sp::variance_min)
//return LeafCluster ();

// Leaf::DisjointCluster
for (DiGraph::Node* node : nodes)
Expand Down Expand Up @@ -4245,7 +4245,7 @@ size_t DistTree::leafCluster2discernibles (const LeafCluster &leafCluster)
if (clusterNodes. size () == 1)
continue;

ASSERT (! DistTree_sp::variance_min);
//ASSERT (! DistTree_sp::variance_min);
const Leaf* first = clusterNodes [0];
ASSERT (first);
Steiner* parent = var_cast (static_cast <const DTNode*> (first->getParent ()) -> asSteiner ());
Expand Down Expand Up @@ -4321,8 +4321,8 @@ size_t DistTree::setDiscernibles_ds ()
}
}

if (DistTree_sp::variance_min)
return 0;
//if (DistTree_sp::variance_min)
//return 0;

FFOR (size_t, row, dissimDs->objs. size ())
if (const Leaf* leaf1 = findPtr (name2leaf, dissimDs->objs [row] -> name))
Expand Down Expand Up @@ -4359,8 +4359,8 @@ size_t DistTree::setDiscernibles ()
leaf->discernible = true;
}

if (DistTree_sp::variance_min)
return 0;
//if (DistTree_sp::variance_min)
//return 0;

const LeafCluster leafCluster (getIndiscernibles ());
const size_t n = leafCluster2discernibles (leafCluster);
Expand Down Expand Up @@ -4873,7 +4873,7 @@ bool DistTree::addDissim (Leaf* leaf1,
ASSERT (leaf1);
ASSERT (leaf2);
IMPLY (! multFixed, mult == 1.0); // mult will be set later
IMPLY (! DistTree_sp::variance_min && ! target && dissimTypes. empty (), leaf1->getCollapsed (leaf2));
IMPLY (/*! DistTree_sp::variance_min &&*/ ! target && dissimTypes. empty (), leaf1->getCollapsed (leaf2));


if ( isNan (target) // prediction must be large ??
Expand Down Expand Up @@ -5158,7 +5158,7 @@ void DistTree::qc () const
{
dissim. qc ();
QC_IMPLY (! subDepth, dissim. target >= 0.0);
QC_IMPLY (! DistTree_sp::variance_min && ! subDepth && ! dissim. target, dissim. indiscernible ());
QC_IMPLY (/*! DistTree_sp::variance_min &&*/ ! subDepth && ! dissim. target, dissim. indiscernible ());
leafSet. addUnique (Pair<const Leaf*> (dissim. leaf1, dissim. leaf2));
if (subDepth)
{ QC_ASSERT (dissim. mult < INF); }
Expand Down Expand Up @@ -5220,7 +5220,7 @@ void DistTree::qc () const
{
const VectorPtr<Leaf>& leaves = it. second;
QC_ASSERT (leaves. size () >= 2);
QC_ASSERT (! DistTree_sp::variance_min);
//QC_ASSERT (! DistTree_sp::variance_min);
for (const Leaf* leaf : leaves)
{
QC_ASSERT (leaf->graph == this);
Expand Down Expand Up @@ -5560,7 +5560,7 @@ void DistTree::setDissimMult (bool usePrediction)


// To keep absCriterion < INF
if (! multFixed && ! variance_min && usePrediction)
if (! multFixed /*&& ! variance_min*/ && usePrediction)
{
unordered_map<const Leaf*,Real/*dissim.target*/> leaf2target_min;
leaf2target_min. rehash (name2leaf. size () / 100 + 1); // PAR
Expand Down
1 change: 0 additions & 1 deletion phylogeny/distTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ struct Leaf : DTNode
friend DissimLine;
void collapse (Leaf* other);
// Output: discernible = false
// Requires: !DistTree_sp::variance_min
// Invokes: setParent()
// To be followed by: DistTree::cleanTopology()
public:
Expand Down
2 changes: 1 addition & 1 deletion phylogeny/distTree_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct ThisApplication : Application
addKey ("variance", "Dissimilarity variance function: " + varianceTypeNames. toString (" | "), varianceTypeNames [varianceType]);
addKey ("variance_power", "Power for -variance pow; >= 0", "NaN");
addFlag ("variance_dissim", "Variance is computed off dissimilarities");
addKey ("variance_min", "Min. dissimilarity variance; to be added to the computed variance. If > 0 then all objects are discernible", "0");
addKey ("variance_min", "Min. dissimilarity variance; to be added to the computed variance", "0");

addKey ("name", "Name of the object");
addKey ("dissim", "File of the format: <obj1> <obj2> <dissimilarity>");
Expand Down
2 changes: 1 addition & 1 deletion phylogeny/makeDistTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct ThisApplication : Application
addKey ("variance_power", "Power for -variance pow; >= 0", "NaN");
addFlag ("variance_dissim", "Variance is computed off dissimilarities");
addFlag ("reinsert_variance_dist", "Variance is computed off tree distances for the reinsert optimization");
addKey ("variance_min", "Min. dissimilarity variance. If > 0 then all objects are discernible", "0"); // ; to be added to the computed variance
addKey ("variance_min", "Min. dissimilarity variance", "0"); // ; to be added to the computed variance

// Processing
addKey ("delete", "Delete leaves whose names are in the indicated file");
Expand Down
2 changes: 1 addition & 1 deletion version.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION "1.1.7"
#define VERSION "1.1.8"

0 comments on commit f141589

Please sign in to comment.