*/
package jalview.datamodel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
public class HiddenSequences
{
alignment.deleteSequence(sequence);
}
- public Vector showAll(
+ public List<SequenceI> showAll(
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- Vector revealedSeqs = new Vector();
+ List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
for (int i = 0; i < hiddenSequences.length; i++)
{
if (hiddenSequences[i] != null)
{
- Vector tmp = showSequence(i, hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
+ List<SequenceI> tmp = showSequence(i, hiddenRepSequences);
+ for (SequenceI seq : tmp)
{
- revealedSeqs.addElement(tmp.elementAt(t));
+ revealedSeqs.add(seq);
}
}
}
return revealedSeqs;
}
- public Vector showSequence(int alignmentIndex,
+ public List<SequenceI> showSequence(int alignmentIndex,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- Vector revealedSeqs = new Vector();
+ List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
if (repSequence != null && hiddenRepSequences != null
&& hiddenRepSequences.containsKey(repSequence))
{
hiddenRepSequences.remove(repSequence);
- revealedSeqs.addElement(repSequence);
+ revealedSeqs.add(repSequence);
}
int start = adjustForHiddenSeqs(alignmentIndex - 1);
{
if (seq.getLength() > 0)
{
- revealedSeqs.addElement(seq);
+ revealedSeqs.add(seq);
asequences.add(alignmentIndex, seq);
}
else
*/
package jalview.viewmodel;
-import jalview.analysis.AAFrequency;
import jalview.analysis.Conservation;
import jalview.api.AlignCalcManagerI;
import jalview.api.AlignViewportI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.schemes.Blosum62ColourScheme;
-import jalview.schemes.ClustalxColourScheme;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.ResidueProperties;
AlignmentAnnotation alignmentAnnotation)
{
if (!alignmentAnnotation.autoCalculated)
+ {
return false;
+ }
if (calculator.workingInvolvedWith(alignmentAnnotation))
{
// System.err.println("grey out ("+alignmentAnnotation.label+")");
selectionGroup = new SequenceGroup();
selectionGroup.setEndRes(alignment.getWidth() - 1);
}
- Vector tmp = alignment.getHiddenSequences().showAll(
+ List<SequenceI> tmp = alignment.getHiddenSequences().showAll(
hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
+ for (SequenceI seq : tmp)
{
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ selectionGroup.addSequence(seq, false);
+ setSequenceAnnotationsVisible(seq, true);
}
hasHiddenRows = false;
public void showSequence(int index)
{
- Vector tmp = alignment.getHiddenSequences().showSequence(index,
+ List<SequenceI> tmp = alignment.getHiddenSequences().showSequence(
+ index,
hiddenRepSequences);
if (tmp.size() > 0)
{
selectionGroup.setEndRes(alignment.getWidth() - 1);
}
- for (int t = 0; t < tmp.size(); t++)
+ for (SequenceI seq : tmp)
{
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ selectionGroup.addSequence(seq, false);
+ setSequenceAnnotationsVisible(seq, true);
}
// JBPNote: refactor: only update flag if we modified visiblity (used to
// do this regardless)
for (int i = 0; i < seq.length; i++)
{
alignment.getHiddenSequences().hideSequence(seq[i]);
+ setSequenceAnnotationsVisible(seq[i], false);
}
hasHiddenRows = true;
firePropertyChange("alignment", null, alignment.getSequences());
}
}
+ /**
+ * Set visibility for any annotations for the given sequence.
+ *
+ * @param sequenceI
+ */
+ protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
+ boolean visible)
+ {
+ for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation())
+ {
+ if (ann.sequenceRef == sequenceI)
+ {
+ ann.visible = visible;
+ }
+ }
+ }
+
public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
{
int sSize = sg.getSize();