JAL-1318 avoid failure if SequenceI objects don't have valid dataset references
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Mon, 17 Jun 2013 09:33:11 +0000 (10:33 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Mon, 17 Jun 2013 09:33:24 +0000 (10:33 +0100)
src/jalview/analysis/Dna.java

index f0041f6..5228413 100644 (file)
@@ -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(),