Merge branch 'feature/JAL-3187linkedFeatures' into feature/JAL-3251biotypedMappings
[jalview.git] / src / jalview / io / gff / GffHelperBase.java
index 41f141b..2206a03 100644 (file)
@@ -88,15 +88,15 @@ public abstract class GffHelperBase implements GffHelperI
     int[] to = new int[] { toStart, toEnd };
 
     /*
-     * Jalview always models from dna to protein, so switch values if the
-     * GFF mapping is from protein to dna
+     * Jalview always models from dna to protein, so invert 
+     * mapping if the GFF mapping is from protein to dna
      */
-    if (mappingType == MappingType.PeptideToNucleotide)
+    if (MappingType.isPeptideToDna(mappingType))
     {
       int[] temp = from;
       from = to;
       to = temp;
-      mappingType = mappingType.getInverse();
+      mappingType = MappingType.CdsToPeptide;
     }
 
     int fromRatio = mappingType.getFromRatio();
@@ -150,8 +150,8 @@ public abstract class GffHelperBase implements GffHelperI
        * restrict from range to make them match up
        * it's kind of arbitrary which end we truncate - here it is the end
        */
-      System.err.print("Truncating mapping from " + Arrays.toString(from)
-              + " to ");
+      System.err.print(
+              "Truncating mapping from " + Arrays.toString(from) + " to ");
       if (from[1] > from[0])
       {
         from[1] -= fromOverlap / toRatio;
@@ -169,8 +169,8 @@ public abstract class GffHelperBase implements GffHelperI
       /*
        * restrict to range to make them match up
        */
-      System.err.print("Truncating mapping to " + Arrays.toString(to)
-              + " to ");
+      System.err.print(
+              "Truncating mapping to " + Arrays.toString(to) + " to ");
       if (to[1] > to[0])
       {
         to[1] -= fromOverlap / fromRatio;
@@ -261,7 +261,8 @@ public abstract class GffHelperBase implements GffHelperI
   /**
    * Parses the input line to a map of name / value(s) pairs. For example the
    * line <br>
-   * Notes=Fe-S;Method=manual curation, prediction; source = Pfam; Notes = Metal <br>
+   * Notes=Fe-S;Method=manual curation, prediction; source = Pfam; Notes = Metal
+   * <br>
    * if parsed with delimiter=";" and separators {' ', '='} <br>
    * would return a map with { Notes={Fe=S, Metal}, Method={manual curation,
    * prediction}, source={Pfam}} <br>
@@ -285,7 +286,7 @@ public abstract class GffHelperBase implements GffHelperI
           String namesDelimiter, char nameValueSeparator,
           String valuesDelimiter)
   {
-    Map<String, List<String>> map = new HashMap<String, List<String>>();
+    Map<String, List<String>> map = new HashMap<>();
     if (text == null || text.trim().length() == 0)
     {
       return map;
@@ -313,7 +314,7 @@ public abstract class GffHelperBase implements GffHelperI
         List<String> vals = map.get(key);
         if (vals == null)
         {
-          vals = new ArrayList<String>();
+          vals = new ArrayList<>();
           map.put(key, vals);
         }
         for (String val : values.split(valuesDelimiter))
@@ -388,8 +389,8 @@ public abstract class GffHelperBase implements GffHelperI
          */
         for (Entry<String, List<String>> attr : attributes.entrySet())
         {
-          String values = StringUtils.listToDelimitedString(
-                  attr.getValue(), ",");
+          String values = StringUtils.listToDelimitedString(attr.getValue(),
+                  ",");
           sf.setValue(attr.getKey(), values);
           if (NOTE.equals(attr.getKey()))
           {