Merge branch 'develop' into features/JAL-2446NCList features/JAL-2446NCList
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 Aug 2017 13:06:46 +0000 (14:06 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 21 Aug 2017 13:06:46 +0000 (14:06 +0100)
Conflicts:
src/MCview/PDBChain.java
src/jalview/analysis/AlignmentSorter.java
src/jalview/analysis/AlignmentUtils.java
src/jalview/analysis/Dna.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/FeatureRenderer.java
src/jalview/appletgui/Finder.java
src/jalview/appletgui/SeqPanel.java
src/jalview/commands/EditCommand.java
src/jalview/datamodel/AlignedCodonFrame.java
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceFeature.java
src/jalview/datamodel/xdb/embl/EmblEntry.java
src/jalview/ext/ensembl/EnsemblGene.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AnnotationExporter.java
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/gui/FeatureRenderer.java
src/jalview/gui/Finder.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/SeqCanvas.java
src/jalview/gui/SeqPanel.java
src/jalview/io/FeaturesFile.java
src/jalview/io/JSONFile.java
src/jalview/io/gff/InterProScanHelper.java
src/jalview/io/vamsas/Datasetsequence.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java
src/jalview/util/RangeComparator.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
src/jalview/ws/jws2/AADisorderClient.java

81 files changed:
1  2 
src/MCview/PDBChain.java
src/jalview/analysis/AAFrequency.java
src/jalview/analysis/AlignmentSorter.java
src/jalview/analysis/AlignmentUtils.java
src/jalview/analysis/Conservation.java
src/jalview/analysis/CrossRef.java
src/jalview/analysis/Dna.java
src/jalview/analysis/Rna.java
src/jalview/analysis/SeqsetUtils.java
src/jalview/analysis/scoremodels/FeatureDistanceModel.java
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/FeatureColourChooser.java
src/jalview/appletgui/FeatureRenderer.java
src/jalview/appletgui/FeatureSettings.java
src/jalview/appletgui/Finder.java
src/jalview/appletgui/IdPanel.java
src/jalview/appletgui/SeqCanvas.java
src/jalview/appletgui/SeqPanel.java
src/jalview/commands/EditCommand.java
src/jalview/controller/AlignViewController.java
src/jalview/datamodel/AlignedCodonFrame.java
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/datamodel/BinarySequence.java
src/jalview/datamodel/Mapping.java
src/jalview/datamodel/SearchResults.java
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceFeature.java
src/jalview/datamodel/xdb/embl/EmblEntry.java
src/jalview/ext/ensembl/EnsemblGene.java
src/jalview/ext/ensembl/EnsemblSeqProxy.java
src/jalview/ext/jmol/JmolParser.java
src/jalview/ext/rbvi/chimera/AtomSpecModel.java
src/jalview/ext/rbvi/chimera/ChimeraCommands.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AnnotationExporter.java
src/jalview/gui/AppVarna.java
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/gui/FeatureColourChooser.java
src/jalview/gui/FeatureRenderer.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/Finder.java
src/jalview/gui/IdPanel.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/Jalview2XML_V1.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/SeqCanvas.java
src/jalview/gui/SeqPanel.java
src/jalview/gui/SequenceFetcher.java
src/jalview/gui/TreePanel.java
src/jalview/io/ClustalFile.java
src/jalview/io/FeaturesFile.java
src/jalview/io/IdentifyFile.java
src/jalview/io/JSONFile.java
src/jalview/io/JnetAnnotationMaker.java
src/jalview/io/MSFfile.java
src/jalview/io/PfamFile.java
src/jalview/io/PhylipFile.java
src/jalview/io/PileUpfile.java
src/jalview/io/SequenceAnnotationReport.java
src/jalview/io/StockholmFile.java
src/jalview/io/StructureFile.java
src/jalview/io/gff/ExonerateHelper.java
src/jalview/io/gff/Gff3Helper.java
src/jalview/io/gff/GffHelperBase.java
src/jalview/io/gff/InterProScanHelper.java
src/jalview/io/vamsas/Datasetsequence.java
src/jalview/io/vamsas/Sequencefeature.java
src/jalview/renderer/seqfeatures/FeatureColourFinder.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java
src/jalview/schemes/ClustalxColourScheme.java
src/jalview/schemes/FeatureColour.java
src/jalview/util/Comparison.java
src/jalview/viewmodel/ViewportRanges.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
src/jalview/ws/DBRefFetcher.java
src/jalview/ws/dbsources/Uniprot.java
src/jalview/ws/jws2/AADisorderClient.java
src/jalview/ws/rest/params/SeqVector.java

@@@ -41,11 -41,11 +41,6 @@@ public class PDBChai
  {
    public static final String RESNUM_FEATURE = "RESNUM";
  
--  /**
--   * SequenceFeature group for PDB File features added to sequences
--   */
--  private static final String PDBFILEFEATURE = "PDBFile";
--
    private static final String IEASTATUS = "IEA:jalview";
  
    public String id;
  
    public String pdbid = "";
  
--  public PDBChain(String pdbid, String id)
++  public PDBChain(String thePdbid, String theId)
    {
--    this.pdbid = pdbid == null ? pdbid : pdbid.toLowerCase();
--    this.id = id;
++    this.pdbid = thePdbid == null ? thePdbid : thePdbid.toLowerCase();
++    this.id = theId;
    }
  
    /**
      {
        status = PDBChain.IEASTATUS;
      }
 -    SequenceFeature[] features = sequence.getSequenceFeatures();
 -    if (features == null)
 -    {
 -      return null;
 -    }
 -    for (int i = 0; i < features.length; i++)
 +
 +    List<SequenceFeature> features = sequence.getSequenceFeatures();
 +    for (SequenceFeature feature : features)
      {
 -      if (features[i].getFeatureGroup() != null
 -              && features[i].getFeatureGroup().equals(pdbid))
 +      if (feature.getFeatureGroup() != null
 +              && feature.getFeatureGroup().equals(pdbid))
        {
 -        SequenceFeature tx = new SequenceFeature(features[i]);
 -        tx.setBegin(1 + residues.elementAt(tx.getBegin() - offset).atoms
 -                .elementAt(0).alignmentMapping);
 -        tx.setEnd(1 + residues.elementAt(tx.getEnd() - offset).atoms
 -                .elementAt(0).alignmentMapping);
 +        int newBegin = 1 + residues.elementAt(feature.getBegin() - offset).atoms
 +                .elementAt(0).alignmentMapping;
 +        int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms
 +                .elementAt(0).alignmentMapping;
 +        SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd,
 +                feature.getFeatureGroup(), feature.getScore());
          tx.setStatus(status
-                 + ((tx.getStatus() == null || tx.getStatus().length() == 0) ? ""
+                 + ((tx.getStatus() == null || tx.getStatus().length() == 0)
+                         ? ""
                          : ":" + tx.getStatus()));
          if (tx.begin != 0 && tx.end != 0)
          {
  
        // Add inserted residues as features to the base residue
        Atom currAtom = resAtoms.get(0);
-       if (currAtom.insCode != ' '
-               && !residues.isEmpty()
-               && residues.lastElement().atoms.get(0).resNumber == currAtom.resNumber)
+       if (currAtom.insCode != ' ' && !residues.isEmpty()
+               && residues.lastElement().atoms
+                       .get(0).resNumber == currAtom.resNumber)
        {
 -        SequenceFeature sf = new SequenceFeature("INSERTION",
 -                currAtom.resName + ":" + currAtom.resNumIns + " " + pdbid
 -                        + id,
 -                "", offset + count - 1, offset + count - 1, "PDB_INS");
 +        String desc = currAtom.resName + ":" + currAtom.resNumIns + " "
 +                + pdbid + id;
 +        SequenceFeature sf = new SequenceFeature("INSERTION", desc, offset
 +                + count - 1, offset + count - 1, "PDB_INS");
          resFeatures.addElement(sf);
          residues.lastElement().atoms.addAll(resAtoms);
        }
@@@ -147,13 -147,14 +147,13 @@@ public class AAFrequenc
        {
          if (sequences[row] == null)
          {
-           System.err
-                   .println("WARNING: Consensus skipping null sequence - possible race condition.");
+           System.err.println(
+                   "WARNING: Consensus skipping null sequence - possible race condition.");
            continue;
          }
 -        char[] seq = sequences[row].getSequence();
 -        if (seq.length > column)
 +        if (sequences[row].getLength() > column)
          {
 -          char c = seq[column];
 +          char c = sequences[row].getCharAt(column);
            residueCounts.add(c);
            if (Comparison.isNucleotide(c))
            {
@@@ -681,49 -682,57 +681,28 @@@ public class AlignmentSorte
  
    public static String FEATURE_DENSITY = "density";
  
-   private static boolean containsIgnoreCase(final String lab,
-           final List<String> labs)
-   {
-     if (labs == null)
-     {
-       return true;
-     }
-     if (lab == null)
-     {
-       return false;
-     }
-     for (String label : labs)
-     {
-       if (lab.equalsIgnoreCase(label))
-       {
-         return true;
-       }
-     }
-     return false;
-   }
    /**
 -   * sort the alignment using the features on each sequence found between start
 -   * and stop with the given featureLabel (and optional group qualifier)
 +   * Sort sequences by feature score or density, optionally restricted by
 +   * feature types, feature groups, or alignment start/end positions.
 +   * <p>
 +   * If the sort is repeated for the same combination of types and groups, sort
 +   * order is reversed.
     * 
 -   * @param featureLabel
 -   *          (may not be null)
 -   * @param groupLabel
 -   *          (may be null)
 -   * @param start
 -   *          (-1 to include non-positional features)
 -   * @param stop
 -   *          (-1 to only sort on non-positional features)
 +   * @param featureTypes
 +   *          a list of feature types to include (or null for all)
 +   * @param groups
 +   *          a list of feature groups to include (or null for all)
 +   * @param startCol
 +   *          start column position to include (base zero)
 +   * @param endCol
 +   *          end column position to include (base zero)
     * @param alignment
 -   *          - aligned sequences containing features
 +   *          the alignment to be sorted
     * @param method
 -   *          - one of the string constants FEATURE_SCORE, FEATURE_LABEL,
 -   *          FEATURE_DENSITY
 +   *          either "average_score" or "density" ("text" not yet implemented)
     */
 -  public static void sortByFeature(String featureLabel, String groupLabel,
 -          int start, int stop, AlignmentI alignment, String method)
 -  {
 -    sortByFeature(
 -            featureLabel == null ? null : Arrays.asList(new String[]
 -            { featureLabel }),
 -            groupLabel == null ? null : Arrays.asList(new String[]
 -            { groupLabel }), start, stop, alignment, method);
 -  }
 -
 -  private static boolean containsIgnoreCase(final String lab,
 -          final List<String> labs)
 -  {
 -    if (labs == null)
 -    {
 -      return true;
 -    }
 -    if (lab == null)
 -    {
 -      return false;
 -    }
 -    for (String label : labs)
 -    {
 -      if (lab.equalsIgnoreCase(label))
 -      {
 -        return true;
 -      }
 -    }
 -    return false;
 -  }
 -
 -  public static void sortByFeature(List<String> featureLabels,
 -          List<String> groupLabels, int start, int stop,
 +  public static void sortByFeature(List<String> featureTypes,
 +          List<String> groups, final int startCol, final int endCol,
            AlignmentI alignment, String method)
    {
      if (method != FEATURE_SCORE && method != FEATURE_LABEL
@@@ -2885,11 -2906,13 +2890,11 @@@ public class AlignmentUtil
       */
      if (seqMap.getTo() == fromSeq.getDatasetSequence())
      {
-       seqMap = new Mapping(seq.getDatasetSequence(), seqMap.getMap()
-               .getInverse());
+       seqMap = new Mapping(seq.getDatasetSequence(),
+               seqMap.getMap().getInverse());
      }
  
 -    char[] fromChars = fromSeq.getSequence();
      int toStart = seq.getStart();
 -    char[] toChars = seq.getSequence();
  
      /*
       * traverse [start, end, start, end...] ranges in fromSeq
@@@ -860,11 -866,12 +861,12 @@@ public class Conservatio
     */
    String getTooltip(int column)
    {
 -    char[] sequence = getConsSequence().getSequence();
 -    char val = column < sequence.length ? sequence[column] : '-';
 +    SequenceI cons = getConsSequence();
 +    char val = column < cons.getLength() ? cons.getCharAt(column) : '-';
      boolean hasConservation = val != '-' && val != '0';
      int consp = column - start;
-     String tip = (hasConservation && consp > -1 && consp < consSymbs.length) ? consSymbs[consp]
+     String tip = (hasConservation && consp > -1 && consp < consSymbs.length)
+             ? consSymbs[consp]
              : "";
      return tip;
    }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1734,8 -1725,8 +1736,8 @@@ public class AlignFrame extends Embmenu
      {
        EditCommand editCommand = (EditCommand) command;
        al = editCommand.getAlignment();
-       Vector comps = (Vector) PaintRefresher.components.get(viewport
-               .getSequenceSetId());
 -      Vector comps = (Vector) PaintRefresher.components
++      Vector comps = PaintRefresher.components
+               .get(viewport.getSequenceSetId());
        for (int i = 0; i < comps.size(); i++)
        {
          if (comps.elementAt(i) instanceof AlignmentPanel)
      PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas,
              newaf.alignPanel.av.getSequenceSetId());
  
-     Vector comps = (Vector) PaintRefresher.components.get(viewport
-             .getSequenceSetId());
 -    Vector comps = (Vector) PaintRefresher.components
++    Vector comps = PaintRefresher.components
+             .get(viewport.getSequenceSetId());
      int viewSize = -1;
      for (int i = 0; i < comps.size(); i++)
      {
@@@ -62,10 -62,11 +62,10 @@@ import java.util.HashSet
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
 -import java.util.Vector;
  
- public class FeatureSettings extends Panel implements ItemListener,
-         MouseListener, MouseMotionListener, ActionListener,
-         AdjustmentListener, FeatureSettingsControllerI
+ public class FeatureSettings extends Panel
+         implements ItemListener, MouseListener, MouseMotionListener,
+         ActionListener, AdjustmentListener, FeatureSettingsControllerI
  {
    FeatureRenderer fr;
  
        }
      }
  
 -    // now add checkboxes which should be visible,
 -    // if they have not already been added
 -    Enumeration<String> en = visibleChecks.elements();
 -
 -    while (en.hasMoreElements())
 +    /*
 +     * now add checkboxes which should be visible,
 +     * if they have not already been added
 +     */
 +    for (String type : displayableTypes)
      {
 -      addCheck(groupsChanged, en.nextElement().toString());
 +      addCheck(groupsChanged, type);
      }
  
-     featurePanel.setLayout(new GridLayout(featurePanel.getComponentCount(),
-             1, 10, 5));
+     featurePanel.setLayout(
+             new GridLayout(featurePanel.getComponentCount(), 1, 10, 5));
      featurePanel.validate();
  
      if (scrollPane != null)
Simple merge
@@@ -278,14 -287,13 +279,15 @@@ public class IdPanel extends Pane
  
      int seq = alignPanel.seqPanel.findSeq(e);
  
-     if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
+     if ((e.getModifiers()
+             & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
      {
 -      Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq);
 +      SequenceI sq = av.getAlignment().getSequenceAt(seq);
  
 -      // build a new links menu based on the current links + any non-positional
 -      // features
 +      /*
 +       *  build a new links menu based on the current links
 +       *  and any non-positional features
 +       */
        List<String> nlinks;
        if (urlProvider != null)
        {
Simple merge
@@@ -1440,10 -1486,11 +1437,11 @@@ public class SeqPanel extends Panel imp
      }
  
      // DETECT RIGHT MOUSE BUTTON IN AWT
-     if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
+     if ((evt.getModifiers()
+             & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
      {
 -      List<SequenceFeature> allFeatures = findFeaturesAtRes(sequence,
 -              sequence.findPosition(res));
 +      List<SequenceFeature> allFeatures = findFeaturesAtColumn(sequence,
 +              sequence.findPosition(column + 1));
  
        Vector<String> links = null;
        for (SequenceFeature sf : allFeatures)
Simple merge
Simple merge
Simple merge
@@@ -1617,12 -1326,13 +1619,12 @@@ public class Sequence extends ASequenc
      if (entry.getSequenceFeatures() != null)
      {
  
 -      SequenceFeature[] sfs = entry.getSequenceFeatures();
 -      for (int si = 0; si < sfs.length; si++)
 +      List<SequenceFeature> sfs = entry.getSequenceFeatures();
 +      for (SequenceFeature feature : sfs)
        {
-         SequenceFeature sf[] = (mp != null) ? mp.locateFeature(feature)
 -        SequenceFeature sf[] = (mp != null) ? mp.locateFeature(sfs[si])
 -                : new SequenceFeature[]
 -                { new SequenceFeature(sfs[si]) };
 -        if (sf != null && sf.length > 0)
++       SequenceFeature sf[] = (mp != null) ? mp.locateFeature(feature)
 +                : new SequenceFeature[] { new SequenceFeature(feature) };
 +        if (sf != null)
          {
            for (int sfi = 0; sfi < sf.length; sfi++)
            {
@@@ -364,28 -368,31 +368,30 @@@ public class EmblEntr
           * workaround until we handle dna location for CDS sequence
           * e.g. location="X53828.1:60..1058" correctly
           */
-         System.err
-                 .println("Implementation Notice: EMBLCDS records not properly supported yet - Making up the CDNA region of this sequence... may be incorrect ("
+         System.err.println(
+                 "Implementation Notice: EMBLCDS records not properly supported yet - Making up the CDNA region of this sequence... may be incorrect ("
                          + sourceDb + ":" + getAccession() + ")");
 -        if (translationLength
 -                * 3 == (1 - codonStart + dna.getSequence().length))
 +        int dnaLength = dna.getLength();
 +        if (translationLength * 3 == (1 - codonStart + dnaLength))
          {
-           System.err
-                   .println("Not allowing for additional stop codon at end of cDNA fragment... !");
+           System.err.println(
+                   "Not allowing for additional stop codon at end of cDNA fragment... !");
            // this might occur for CDS sequences where no features are marked
            exons = new int[] { dna.getStart() + (codonStart - 1),
                dna.getEnd() };
-           dnaToProteinMapping = new Mapping(product, exons, new int[] { 1,
-               translationLength }, 3, 1);
+           dnaToProteinMapping = new Mapping(product, exons,
+                   new int[]
+                   { 1, translationLength }, 3, 1);
          }
 -        if ((translationLength + 1)
 -                * 3 == (1 - codonStart + dna.getSequence().length))
 +        if ((translationLength + 1) * 3 == (1 - codonStart + dnaLength))
          {
-           System.err
-                   .println("Allowing for additional stop codon at end of cDNA fragment... will probably cause an error in VAMSAs!");
+           System.err.println(
+                   "Allowing for additional stop codon at end of cDNA fragment... will probably cause an error in VAMSAs!");
            exons = new int[] { dna.getStart() + (codonStart - 1),
                dna.getEnd() - 3 };
-           dnaToProteinMapping = new Mapping(product, exons, new int[] { 1,
-               translationLength }, 3, 1);
+           dnaToProteinMapping = new Mapping(product, exons,
+                   new int[]
+                   { 1, translationLength }, 3, 1);
          }
        }
        else
    /**
     * Helper method to construct a SequenceFeature for one cds range
     * 
 -   * @param exons
 -   *          array of cds [start, end, ...] positions
 -   * @param exonStartIndex
 -   *          offset into the exons array
 -   * @param proteinName
 -   * @param proteinAccessionId
 +   * @param type
 +   *          feature type ("CDS")
 +   * @param desc
 +   *          description
 +   * @param begin
 +   *          start position
 +   * @param end
 +   *          end position
 +   * @param group
 +   *          feature group
     * @param vals
     *          map of 'miscellaneous values' for feature
 -   * @param codonStart
 -   *          codon start position for CDS (1/2/3, normally 1)
     * @return
     */
 -  protected SequenceFeature makeCdsFeature(int[] exons, int exonStartIndex,
 -          String proteinName, String proteinAccessionId,
 -          Map<String, String> vals, int codonStart)
 +  protected SequenceFeature makeCdsFeature(String type, String desc,
 +          int begin, int end, String group, Map<String, String> vals)
    {
 -    int exonNumber = exonStartIndex / 2 + 1;
 -    SequenceFeature sf = new SequenceFeature();
 -    sf.setBegin(Math.min(exons[exonStartIndex], exons[exonStartIndex + 1]));
 -    sf.setEnd(Math.max(exons[exonStartIndex], exons[exonStartIndex + 1]));
 -    sf.setDescription(String.format("Exon %d for protein '%s' EMBLCDS:%s",
 -            exonNumber, proteinName, proteinAccessionId));
 -    sf.setPhase(String.valueOf(codonStart - 1));
 -    sf.setStrand(
 -            exons[exonStartIndex] <= exons[exonStartIndex + 1] ? "+" : "-");
 -    sf.setValue(FeatureProperties.EXONPOS, exonNumber);
 -    sf.setValue(FeatureProperties.EXONPRODUCT, proteinName);
 +    SequenceFeature sf = new SequenceFeature(type, desc, begin, end, group);
      if (!vals.isEmpty())
      {
        StringBuilder sb = new StringBuilder();
@@@ -631,11 -609,11 +633,12 @@@ public abstract class EnsemblSeqProxy e
       * a final sort is needed since Ensembl returns CDS sorted within source
       * (havana / ensembl_havana)
       */
 -    Collections.sort(regions, new RangeComparator(direction == 1));
 +    Collections.sort(regions, direction == 1 ? IntRangeComparator.ASCENDING
 +            : IntRangeComparator.DESCENDING);
  
-     List<int[]> to = Arrays.asList(new int[] { start,
-         start + mappedLength - 1 });
+     List<int[]> to = Arrays
+             .asList(new int[]
+             { start, start + mappedLength - 1 });
  
      return new MapList(regions, to, 1, 1);
    }
Simple merge
@@@ -1,6 -1,26 +1,26 @@@
+ /*
+  * 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.ext.rbvi.chimera;
  
 -import jalview.util.RangeComparator;
 +import jalview.util.IntRangeComparator;
  
  import java.util.ArrayList;
  import java.util.Collections;
Simple merge
Simple merge
Simple merge
@@@ -241,21 -239,14 +241,20 @@@ public class FeatureRendere
         */
        gridPanel = new JPanel(new GridLayout(4, 1));
        JPanel choosePanel = new JPanel();
-       choosePanel.add(new JLabel(MessageManager
-               .getString("label.select_feature")
-               + ":"));
+       choosePanel.add(new JLabel(
+               MessageManager.getString("label.select_feature") + ":"));
        final JComboBox<String> overlaps = new JComboBox<String>();
 +      List<String> added = new ArrayList<>();
        for (SequenceFeature sf : features)
        {
 -        String text = sf.getType() + "/" + sf.getBegin() + "-" + sf.getEnd()
 -                + " (" + sf.getFeatureGroup() + ")";
 +        String text = String.format("%s/%d-%d (%s)", sf.getType(),
 +                sf.getBegin(), sf.getEnd(), sf.getFeatureGroup());
 +        while (added.contains(text))
 +        {
 +          text += " ";
 +        }
          overlaps.addItem(text);
 +        added.add(text);
        }
        choosePanel.add(overlaps);
  
              highlight.addResult(sequences.get(0), sf.getBegin(),
                      sf.getEnd());
  
 -            alignPanel.getSeqPanel().seqCanvas
 -                    .highlightSearchResults(highlight);
 -
 +            alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(
 +                    highlight, false);
            }
            FeatureColourI col = getFeatureStyle(name.getText());
            if (col == null)
@@@ -633,10 -672,10 +636,10 @@@ public class FeatureSettings extends JP
  
          data[dataIndex][0] = type;
          data[dataIndex][1] = fr.getFeatureStyle(type);
-         data[dataIndex][2] = new Boolean(af.getViewport()
-                 .getFeaturesDisplayed().isVisible(type));
+         data[dataIndex][2] = new Boolean(
+                 af.getViewport().getFeaturesDisplayed().isVisible(type));
          dataIndex++;
 -        visibleChecks.removeElement(type);
 +        displayableTypes.remove(type);
        }
      }
  
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1949,12 -1954,11 +1953,12 @@@ public class PopupMenu extends JPopupMe
       */
      if (!seqs.isEmpty())
      {
-       if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(
-               seqs, features, true, ap))
+       if (ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+               .amendFeatures(seqs, features, true, ap))
        {
          ap.alignFrame.setShowSeqFeatures(true);
 -        ap.highlightSearchResults(null);
 +        ap.av.setSearchResults(null); // clear highlighting
 +        ap.repaint(); // draw new/amended features
        }
      }
    }
@@@ -208,10 -206,10 +208,10 @@@ public class SeqCanvas extends JCompone
  
        if (value != -1)
        {
 -        int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
 +        int x = labelWidthWest - fm.stringWidth(String.valueOf(value))
                  - charWidth / 2;
-         g.drawString(value + "", x, (ypos + (i * charHeight))
-                 - (charHeight / 5));
+         g.drawString(value + "", x,
+                 (ypos + (i * charHeight)) - (charHeight / 5));
        }
      }
    }
  
        if (av.isShowSequenceFeatures())
        {
-         fr.drawSequence(g, nextSeq, startRes, endRes, offset
-                 + ((i - startSeq) * charHeight), false);
+         fr.drawSequence(g, nextSeq, startRes, endRes,
+                 offset + ((i - startSeq) * charHeight), false);
        }
  
 -      // / Highlight search Results once all sequences have been drawn
 -      // ////////////////////////////////////////////////////////
 +      /*
 +       * highlight search Results once sequence has been drawn
 +       */
        if (av.hasSearchResults())
        {
 -        int[] visibleResults = av.getSearchResults().getResults(nextSeq,
 +        SearchResultsI searchResults = av.getSearchResults();
 +        int[] visibleResults = searchResults.getResults(nextSeq,
                  startRes, endRes);
          if (visibleResults != null)
          {
@@@ -1275,7 -1258,7 +1274,7 @@@ public class SeqPanel extends JPane
          // Find the next gap before the end
          // of the visible region boundary
          boolean blank = false;
--        for (fixedRight = fixedRight; fixedRight > lastres; fixedRight--)
++        for (; fixedRight > lastres; fixedRight--)
          {
            blank = true;
  
Simple merge
Simple merge
Simple merge
@@@ -44,9 -44,8 +44,8 @@@ import java.awt.Color
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Arrays;
 +import java.util.Collections;
- import java.util.Comparator;
  import java.util.HashMap;
 -import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Map.Entry;
@@@ -108,14 -94,14 +94,14 @@@ public class FeaturesFile extends Align
    /**
     * Constructor which does not parse the file immediately
     * 
--   * @param inFile
++   * @param file
     * @param paste
     * @throws IOException
     */
--  public FeaturesFile(String inFile, DataSourceType paste)
++  public FeaturesFile(String file, DataSourceType paste)
            throws IOException
    {
--    super(false, inFile, paste);
++    super(false, file, paste);
    }
  
    /**
     * Constructor that optionally parses the file immediately
     * 
     * @param parseImmediately
--   * @param inFile
++   * @param file
     * @param type
     * @throws IOException
     */
--  public FeaturesFile(boolean parseImmediately, String inFile,
-           DataSourceType type)
-           throws IOException
++  public FeaturesFile(boolean parseImmediately, String file,
+           DataSourceType type) throws IOException
    {
--    super(parseImmediately, inFile, type);
++    super(parseImmediately, file, type);
    }
  
    /**
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -48,12 -45,12 +48,12 @@@ public class Datasetsequence extends Da
    // private AlignmentI jvdset;
  
    public Datasetsequence(VamsasAppDatastore vamsasAppDatastore,
--          SequenceI sq, String dict, DataSet dataset)
++          SequenceI sq, String theDict, DataSet theDataset)
    {
      super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class);
--    this.dataset = dataset;
++    this.dataset = theDataset;
      // this.jvdset = jvdset;
--    this.dict = dict;
++    this.dict = theDict;
      doSync();
    }
  
      return modifiedtheseq;
    }
  
 +  @Override
    public void conflict()
    {
-     log.warn("Conflict in dataset sequence update to document. Overwriting document");
+     log.warn(
+             "Conflict in dataset sequence update to document. Overwriting document");
      // TODO: could try to import from document data to jalview first. and then
      updateToDoc();
    }
@@@ -402,6 -400,23 +401,27 @@@ public class FeatureRenderer extends Fe
    }
  
    /**
++<<<<<<< HEAD
++=======
+    * Answers true if the feature belongs to a feature group which is not
+    * currently displayed, else false
+    * 
+    * @param sequenceFeature
+    * @return
+    */
++  @Override
+   protected boolean featureGroupNotShown(
+           final SequenceFeature sequenceFeature)
+   {
+     return featureGroups != null && sequenceFeature.featureGroup != null
+             && sequenceFeature.featureGroup.length() != 0
+             && featureGroups.containsKey(sequenceFeature.featureGroup)
+             && !featureGroups.get(sequenceFeature.featureGroup)
+                     .booleanValue();
+   }
+   /**
++>>>>>>> refs/heads/develop
     * Called when alignment in associated view has new/modified features to
     * discover and display.
     * 
Simple merge
Simple merge
Simple merge
@@@ -62,9 -63,9 +62,9 @@@ public class AADisorderClient extends J
    AlignFrame af;
  
    public AADisorderClient(Jws2Instance sh, AlignFrame alignFrame,
--          WsParamSetI preset, List<Argument> paramset)
++          WsParamSetI thePreset, List<Argument> paramset)
    {
--    super(sh, alignFrame, preset, paramset);
++    super(sh, alignFrame, thePreset, paramset);
      af = alignFrame;
      typeName = sh.action;
      methodName = sh.serviceType;