Skip to content

Commit

Permalink
Add warning for single placement in analyze methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lczech committed Jun 28, 2024
1 parent a53b0ec commit 5e78748
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/md/dispersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The command takes a set of `jplace` files, and calculates and visualizes the Edge Dispersion per edge of the reference tree. The files need to have the same reference tree.

Edge Dispersion is explained and evaluated in detail in our article (in preparation). The following figure and its caption are an example adapted from this article:
Edge Dispersion is explained and evaluated in detail in our article (doi:[10.1371/journal.pone.0217050](https://doi.org/10.1371/journal.pone.0217050)). The following figure and its caption are an example adapted from this article:

<br>

Expand Down
8 changes: 8 additions & 0 deletions src/commands/analyze/correlation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,14 @@ void run_correlation( CorrelationOptions const& options )

// Get the data. Read all samples and calcualte the matrices.
auto const profile = options.jplace_input.placement_profile();
assert( profile.edge_masses.rows() == profile.edge_imbalances.rows() );
assert( profile.edge_masses.cols() == profile.edge_imbalances.cols() );
if( profile.edge_masses.rows() <= 1 ) {
throw std::runtime_error(
"Cannot compute edge correlation of a single sample, as the method is meant to relate "
"a set of samples to their meta-data features."
);
}

LOG_MSG1 << "Calculating correlations and writing files.";

Expand Down
8 changes: 8 additions & 0 deletions src/commands/analyze/dispersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,14 @@ void run_dispersion( DispersionOptions const& options )

// Get the data. Read all samples and calcualte the matrices.
auto const profile = options.jplace_input.placement_profile();
assert( profile.edge_masses.rows() == profile.edge_imbalances.rows() );
assert( profile.edge_masses.cols() == profile.edge_imbalances.cols() );
if( profile.edge_masses.rows() <= 1 ) {
throw std::runtime_error(
"Cannot compute edge dispersion of a single sample, as the method is meant to visualize "
"dispersion (variance) across a set of samples."
);
}

LOG_MSG2 << "Calculating dispersions and writing files.";

Expand Down

0 comments on commit 5e78748

Please sign in to comment.