Uploaded image for project: 'Jalview'
  1. Jalview
  2. JAL-4624

An ArrayIndexOutOfBoundsException is thrown when performing a PCA with secondary structures

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.11.5.0
    • Fix Version/s: None
    • Component/s: trees
    • Labels:
      None

      Description

      When performing a PCA with secondary structures rather than sequences, there is a loop in
      jalview.viewmodel.PCAModel.calculate()
      that assumes the arrays "seqs" and "scores" are the same length. This results in
      java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4
      at jalview.viewmodel.PCAModel.calculate(PCAModel.java:108)
      at jalview.gui.PCAPanel.run(PCAPanel.java:209)
      at java.base/java.lang.Thread.run(Thread.java:829)

      The code is:
          int height = pca.getHeight();
          // top = pca.getM().height() - 1;
          top = height - 1;

          points = new Vector<>();
          Point[] scores = pca.getComponents(top - 1, top - 2, top - 3, 1);

          for (int i = 0; i < height; i++)
          {
            SequencePoint sp = new SequencePoint(seqs[i], scores[i]);
            points.add(sp);
          }

      The line with seqs[i] and scores[i] produces the Exception as seqs cannot keep up with scores which is how height is set (I think).

      The value of this.pca.sequences.seqs is noted to be the same size as scores and I wonder if this should be used in the isAnnotationBased case? Maybe it can be used in all cases? Some input from [~jalviewadmin] may be required here.

        Attachments

          Activity

            People

            Assignee:
            reniacorreya Renia Correya
            Reporter:
            soares Ben Soares
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: