JAL-2023 avoid writing / loading empty mappings
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 20 Jul 2016 09:00:24 +0000 (10:00 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 20 Jul 2016 09:00:24 +0000 (10:00 +0100)
src/jalview/gui/Jalview2XML.java

index ac85aad..1633a5d 100644 (file)
@@ -898,10 +898,10 @@ public class Jalview2XML
       for (AlignedCodonFrame acf : jac)
       {
         AlcodonFrame alc = new AlcodonFrame();
-        vamsasSet.addAlcodonFrame(alc);
         if (acf.getProtMappings() != null
                 && acf.getProtMappings().length > 0)
         {
+          boolean hasMap = false;
           SequenceI[] dnas = acf.getdnaSeqs();
           jalview.datamodel.Mapping[] pmaps = acf.getProtMappings();
           for (int m = 0; m < pmaps.length; m++)
@@ -911,6 +911,11 @@ public class Jalview2XML
             alcmap.setMapping(createVamsasMapping(pmaps[m], dnas[m], null,
                     false));
             alc.addAlcodMap(alcmap);
+            hasMap = true;
+          }
+          if (hasMap)
+          {
+            vamsasSet.addAlcodonFrame(alc);
           }
         }
         // TODO: delete this ? dead code from 2.8.3->2.9 ?
@@ -2855,8 +2860,8 @@ public class Jalview2XML
                   mapping });
             }
           }
+          al.addCodonFrame(cf);
         }
-        al.addCodonFrame(cf);
       }
     }