From e498cc04385671872ab98220219aaeac2ec245f2 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 17 Jun 2013 10:33:11 +0100 Subject: [PATCH] JAL-1318 avoid failure if SequenceI objects don't have valid dataset references --- src/jalview/analysis/Dna.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java index f0041f6..5228413 100644 --- a/src/jalview/analysis/Dna.java +++ b/src/jalview/analysis/Dna.java @@ -131,11 +131,14 @@ public class Dna { pepseqs.addElement(newseq); SequenceI ds = newseq; - while (ds.getDatasetSequence() != null) + if (dataset != null) { - ds = ds.getDatasetSequence(); + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); + } + dataset.addSequence(ds); } - dataset.addSequence(ds); } } if (codons.aaWidth == 0) @@ -676,7 +679,7 @@ public class Dna private static void transferCodedFeatures(SequenceI dna, SequenceI pep, MapList map, Hashtable featureTypes, Hashtable featureGroups) { - SequenceFeature[] sf = dna.getDatasetSequence().getSequenceFeatures(); + SequenceFeature[] sf = (dna.getDatasetSequence()!=null ? dna.getDatasetSequence() : dna).getSequenceFeatures(); Boolean fgstate; jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils .selectRefs(dna.getDBRef(), -- 1.7.10.2