JAL-4386 Added further checks for sequences that have no secondary structure.
[jalview.git] / src / jalview / analysis / scoremodels / SecondaryStructureDistanceModel.java
index 7fcee35..0aac7fa 100644 (file)
@@ -255,14 +255,19 @@ public class SecondaryStructureDistanceModel extends DistanceScoreModel
          int seqPosition = seq.findPosition(columnPosition);
          AlignmentAnnotation[] aa = seq.getRefSeq().getAnnotation("Secondary Structure");
          if (aa != null) {
+           if (aa[0].getAnnotationForPosition(seqPosition) != null) {
              Annotation a = aa[0].getAnnotationForPosition(seqPosition);
              ss = a.secondaryStructure;
              if (ss == ' ') {
-                 ss = 'C'; // In JalView, 'C' is represented as ' ' 
-             }
-             if (ss != '\0') { // Check if ss is not the default null character
-                 secondaryStructure.add(String.valueOf(ss));
+               ss = 'C'; // In JalView, 'C' is represented as ' ' 
              }
+           }
+           else {
+             ss = 'C';
+           }
+           if (ss != '\0') { // Check if ss is not the default null character
+             secondaryStructure.add(String.valueOf(ss));
+           }
          }
          return secondaryStructure;
   }