Class GroupedTreeStatistics

java.lang.Object
sc.fiji.snt.analysis.GroupedTreeStatistics

public class GroupedTreeStatistics extends Object
Computes statistics from Tree groups.
Author:
Tiago Ferreira
See Also:
  • Constructor Details

    • GroupedTreeStatistics

      public GroupedTreeStatistics()
      Instantiates a new grouped tree statistics.
  • Method Details

    • addGroup

      public void addGroup(Collection<Tree> group, String groupLabel)
      Adds a comparison group to the analysis queue.
      Parameters:
      group - the group
      groupLabel - a unique label identifying the group
    • addGroup

      public void addGroup(Collection<Tree> group, String groupLabel, String... swcTypes) throws NoSuchElementException
      Adds a comparison group to the analysis queue.
      Parameters:
      group - the collection of Trees to be analyzed
      groupLabel - a unique label identifying the group
      swcTypes - SWC type(s) a string with at least 2 characters describing the SWC type allowed in the subtree (e.g., 'axn', or 'dendrite')
      Throws:
      NoSuchElementException - swcTypes are not applicable to group
    • getGroupStats

      public MultiTreeStatistics getGroupStats(String groupLabel)
      Gets the group statistics.
      Parameters:
      groupLabel - the unique label identifying the group
      Returns:
      the group statistics or null if no group is mapped to groupLabel
    • tTest

      public double tTest(String measurement, String group1Label, String group2Label) throws org.apache.commons.math3.exception.MathIllegalArgumentException
      Computes a two-sample, two-tailed t-test P-value for two of groups being analyzed. It is assumed that data fulfills basic assumptions on normality, variance homogeneity, etc.
      Parameters:
      measurement - the measurement (N_NODES, NODE_RADIUS, etc.)
      group1Label - the unique label identifying group 1
      group2Label - the unique label identifying group 2
      Returns:
      the p-value
      Throws:
      org.apache.commons.math3.exception.MathIllegalArgumentException - If the computation fails
    • anovaPValue

      public double anovaPValue(String measurement) throws org.apache.commons.math3.exception.MathIllegalArgumentException
      Computes the one-way ANOVA P-value for all the groups being analyzed. It is assumed that data fulfills basic assumptions on normality, variance homogeneity, sample size, etc.
      Parameters:
      measurement - the measurement (N_NODES, NODE_RADIUS, etc.)
      Returns:
      the p-value
      Throws:
      org.apache.commons.math3.exception.MathIllegalArgumentException - If the computation fails, E.g., because less than 2 groups exist, one of the groups contains less than two trees, or a convergence error occurs
    • getN

      public int getN(String groupLabel)
      Gets the number of Trees in a specified group.
      Parameters:
      groupLabel - the unique label identifying the group
      Returns:
      the number of Trees or -1 if no group is mapped to groupLabel
    • getGroups

      public List<String> getGroups()
      Gets the group identifiers currently queued for analysis.
      Returns:
      the group identifiers
    • getHistogram

      public SNTChart getHistogram(String measurement)
      Gets the relative frequencies histogram for a univariate measurement. The number of bins is determined using the Freedman-Diaconis rule.
      Parameters:
      measurement - the measurement (N_NODES, NODE_RADIUS, etc.)
      Returns:
      the frame holding the histogram
      See Also:
    • getPolarHistogram

      public SNTChart getPolarHistogram(String measurement)
      Gets the relative frequencies histogram for a univariate measurement as a polar (rose) plot assuming a data range between [0-360]. The number of bins is determined using the Freedman-Diaconis rule.
      Parameters:
      measurement - the measurement (e.g., MultiTreeStatistics.AVG_REMOTE_ANGLE
      Returns:
      the frame holding the histogram
      See Also:
    • getBoxPlot

      public SNTChart getBoxPlot(String measurement)
      Assembles a Box and Whisker Plot for the specified measurement (cell morphometry).
      Parameters:
      measurement - the measurement (N_NODES, NODE_RADIUS, etc.)
      Returns:
      the frame holding the box plot
      See Also:
    • getBoxPlot

      public SNTChart getBoxPlot(String feature, Collection<BrainAnnotation> annotations)
      Assembles a Box and Whisker Plot for the specified feature (absolute measurements).
      Parameters:
      feature - the feature ("Cable length", "No. of branch points", "No. of tips", etc.). Note that the majority of TreeStatistics.getAllMetrics() metrics are currently not supported.
      annotations - the BrainAnnotations to be queried. Null not allowed.
      Returns:
      the box plot
    • getBoxPlot

      public SNTChart getBoxPlot(String feature, Collection<BrainAnnotation> annotations, double cutoff, boolean normalize)
      Assembles a Box and Whisker Plot for the specified feature.
      Parameters:
      feature - the feature ("Cable length", "No. of branch points", "No. of tips", etc.). Note that the majority of TreeStatistics.getAllMetrics() metrics are currently not supported.
      annotations - the BrainAnnotations to be queried. Null not allowed.
      cutoff - a filtering option. If the computed feature for an annotation is below this value, that annotation is excluded from the plot
      normalize - If true, values are retrieved as ratios. E.g., If feature is "Cable length", and cutoff 0.1, BrainAnnotations in annotations associated with less than 10% of cable length are ignored.
      Returns:
      the box plot
    • getBoxPlot

      public SNTChart getBoxPlot(String feature, int depth, double cutoff, boolean normalize)
      Assembles a Box and Whisker Plot for the specified feature.
      Parameters:
      feature - the feature ("Cable length", "No. of branch points", "No. of tips", etc.). Note that the majority of TreeStatistics.getAllMetrics() metrics are currently not supported.
      depth - the ontological depth of the compartments to be considered
      cutoff - a filtering option. If the computed feature for an annotation is below this value, that annotation is excluded from the plot * @param normalize If true, values are retrieved as ratios. E.g., If feature is "Cable length", and cutoff 0.1, BrainAnnotations in annotations associated with less than 10% of cable length are ignored.
      Returns:
      the box plot
    • getFlowPlot

      public SNTChart getFlowPlot(String feature, Collection<BrainAnnotation> annotations, boolean normalize)
      Assembles a Flow plot (aka Sankey diagram) for the specified feature using "mean" as integration statistic, and no cutoff value.
      See Also:
    • getFlowPlot

      public SNTChart getFlowPlot(String feature, int depth)
      Assembles a Flow plot (aka Sankey diagram) for the specified feature using "mean" as integration statistic, no cutoff value, and all of the brain regions of the specified ontology depth.
      Parameters:
      feature - the feature ("Cable length", "No. of branch points", "No. of tips", etc.).
      depth - the ontological depth of the compartments to be considered
      Returns:
      the flow plot
      See Also:
    • getFlowPlot

      public SNTChart getFlowPlot(String feature, int depth, double cutoff, boolean normalize)
      Assembles a Flow plot (aka Sankey diagram) for the specified feature using "mean" as integration statistic, no cutoff value, and all of the brain regions of the specified ontology depth. *
      Parameters:
      feature - the feature ("Cable length", "No. of branch points", "No. of tips", etc.)
      depth - the ontological depth of the compartments to be considered
      cutoff - a filtering option. If the computed feature for an annotation is below this value, that annotation is excluded from the plot
      normalize - If true, values are retrieved as ratios. E.g., If feature is "Cable length", and cutoff 0.1, BrainAnnotations in annotations associated with less than 10% of cable length are ignored.
      Returns:
      the flow plot
    • getFlowPlot

      public SNTChart getFlowPlot(String feature, Collection<BrainAnnotation> annotations, String statistic, double cutoff, boolean normalize)
      Assembles a Flow plot (aka Sankey diagram) for the specified feature.
      Parameters:
      feature - the feature ("Cable length", "No. of branch points", "No. of tips", etc.). Note that the majority of TreeStatistics.getAllMetrics() metrics are currently not supported.
      annotations - the BrainAnnotations to be queried. Null not allowed.
      statistic - the integration statistic (lower case). Either "mean", "sum", "min" or "max". Null not allowed.
      cutoff - a filtering option. If the computed feature for an annotation is below this value, that annotation is excluded from the plot
      normalize - If true, values are retrieved as ratios. E.g., If feature is "Cable length", and cutoff 0.1, BrainAnnotations in annotations associated with less than 10% of cable length are ignored.
      Returns:
      the SNTChart holding the flow plot
    • setMinNBins

      public void setMinNBins(int minNoOfBins)
      Sets the minimum number of bins when assembling histograms.
      Parameters:
      minNoOfBins - the minimum number of bins.
    • main

      public static void main(String[] args)