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.
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.