JAL-4386 account for null entries in sequence array passed to the score model - usual...
authorJim Procter <jprocter@dundee.ac.uk>
Thu, 27 Jun 2024 16:52:01 +0000 (17:52 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Thu, 27 Jun 2024 16:52:01 +0000 (17:52 +0100)
src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java

index 468c3c5..97200bf 100644 (file)
@@ -120,20 +120,27 @@ public class SecondaryStructureDistanceModel extends DistanceScoreModel
     
     for (SeqCigar scig : seqData.getSequences())
     {
+      // get the next sequence that should be bound to this scig: may be null
       SequenceI alSeq = sequences[sq++];
       List<AlignmentAnnotation> ssec = ssAlignmentAnnotationForSequences.get(scig.getRefSeq());
       if (ssec == null)
       {
         // not defined
         newSequences.add(alSeq);
-        labels.add(alSeq.getName()+"|"+" No Secondary Structure");
+        if (alSeq!=null) {
+          labels.add(alSeq.getName()+"|"+" No Secondary Structure");
+        }
         SeqCigar newSeqCigar = scig; //new SeqCigar(scig);
         newCigs.add(newSeqCigar);
         ssForSeqs.add(null);
       } else {
         for (int i = 0; i < ssec.size(); i++)
         {
-          labels.add(alSeq.getName()+"|"+AlignmentUtils.extractSSSourceFromAnnotationDescription(ssec.get(i)));
+          if (alSeq != null)
+          {
+            labels.add(alSeq.getName() + "|" + AlignmentUtils
+                    .extractSSSourceFromAnnotationDescription(ssec.get(i)));
+          }
           //newSequences.add(seq);
           newSequences.add(alSeq);
           SeqCigar newSeqCigar = scig; // new SeqCigar(scig);