From b1b730f3af908258040654202f4540c8a57c56a7 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 27 Jun 2024 17:52:01 +0100 Subject: [PATCH] JAL-4386 account for null entries in sequence array passed to the score model - usually only for the tests --- .../scoremodels/SecondaryStructureDistanceModel.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java b/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java index 468c3c5..97200bf 100644 --- a/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java +++ b/src/jalview/analysis/scoremodels/SecondaryStructureDistanceModel.java @@ -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 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); -- 1.7.10.2