Merge branch 'patch/JAL-3874_newJmolAndGradleDedup' into develop
[jalview.git] / src / jalview / io / gff / ExonerateHelper.java
index 1ee99c0..9ce4cc6 100644 (file)
@@ -1,5 +1,27 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.io.gff;
 
+import java.util.Locale;
+
 import jalview.datamodel.AlignedCodonFrame;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.MappingType;
@@ -145,7 +167,8 @@ public class ExonerateHelper extends Gff2Helper
     SequenceI mapFromSequence = seq;
     SequenceI mapToSequence = mappedSequence;
     if ((type == MappingType.NucleotideToPeptide && featureIsOnTarget)
-            || (type == MappingType.PeptideToNucleotide && !featureIsOnTarget))
+            || (type == MappingType.PeptideToNucleotide
+                    && !featureIsOnTarget))
     {
       mapFromSequence = mappedSequence;
       mapToSequence = seq;
@@ -247,8 +270,8 @@ public class ExonerateHelper extends Gff2Helper
     {
       fromStart = alignToStart;
       toStart = alignFromStart;
-      toEnd = forwardStrand ? toStart + alignCount - 1 : toStart
-              - (alignCount - 1);
+      toEnd = forwardStrand ? toStart + alignCount - 1
+              : toStart - (alignCount - 1);
       int toLength = Math.abs(toEnd - toStart) + 1;
       int fromLength = toLength * type.getFromRatio() / type.getToRatio();
       fromEnd = fromStart + fromLength - 1;
@@ -320,7 +343,7 @@ public class ExonerateHelper extends Gff2Helper
     // e.g. exonerate:protein2genome:local
     if (model != null)
     {
-      String mdl = model.toLowerCase();
+      String mdl = model.toLowerCase(Locale.ROOT);
       if (mdl.contains(PROTEIN2DNA) || mdl.contains(PROTEIN2GENOME)
               || mdl.contains(CODING2CODING) || mdl.contains(CODING2GENOME)
               || mdl.contains(CDNA2GENOME) || mdl.contains(GENOME2GENOME))
@@ -332,12 +355,16 @@ public class ExonerateHelper extends Gff2Helper
     return false;
   }
 
+  /**
+   * An override to set feature group to "exonerate" instead of the default GFF
+   * source value (column 2)
+   */
   @Override
   protected SequenceFeature buildSequenceFeature(String[] gff,
           Map<String, List<String>> set)
   {
-    SequenceFeature sf = super.buildSequenceFeature(gff, set);
-    sf.setFeatureGroup("exonerate");
+    SequenceFeature sf = super.buildSequenceFeature(gff, TYPE_COL,
+            "exonerate", set);
 
     return sf;
   }