X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FAlignmentView.java;h=a23aad5e837e04ad8d4e19a8feacadb76b2aba0b;hb=27d1490bba5753b3f9c8fac0647cfe8148c53310;hp=325fc459e4caf2d20e38183ff2d1a6aa72af25a0;hpb=a7a95ccfd3f0b5cd94e477ba37b9011d7ce84aee;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index 325fc45..a23aad5 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -21,6 +21,7 @@ import jalview.util.ShiftList; import java.io.PrintStream; import java.util.Enumeration; +import java.util.List; import java.util.Vector; /** @@ -105,9 +106,9 @@ public class AlignmentView SequenceI[] selseqs; if (selection != null) { - Vector sel = selection.getSequences(null); + List sel = selection.getSequences(null); this.selected = new Vector(); - selseqs = selection.getSequencesInOrder(alignment, false); + selseqs = selection.getSequencesInOrder(alignment, selectedRegionOnly); } else { @@ -116,12 +117,8 @@ public class AlignmentView // get the alignment's group list and make a copy Vector grps = new Vector(); - Vector gg = alignment.getGroups(); - Enumeration gge = gg.elements(); - while (gge.hasMoreElements()) - { - grps.addElement(gge.nextElement()); - } + List gg = alignment.getGroups(); + grps.addAll(gg); ScGroup[] sgrps = null; boolean addedgps[] = null; if (grps != null) @@ -134,7 +131,7 @@ public class AlignmentView // visible and selected region int ssel = selection.getStartRes(), esel = selection.getEndRes(); Vector isg = new Vector(); - Enumeration en = grps.elements(); + Enumeration en = grps.elements(); while (en.hasMoreElements()) { sg = (SequenceGroup) en.nextElement(); @@ -150,6 +147,9 @@ public class AlignmentView { sg.setEndRes(esel); } + sg.setStartRes(sg.getStartRes()-ssel+1); + sg.setEndRes(sg.getEndRes()-ssel+1); + isg.addElement(sg); } } @@ -332,7 +332,7 @@ public class AlignmentView * prune any groups to the visible coordinates of the alignment. */ { - int nvg = scGroups != null ? scGroups.size() : 0; + int nvg = (scGroups != null) ? scGroups.size() : 0; if (nvg > 0) { SequenceGroup[] nsg = new SequenceGroup[nvg]; @@ -348,9 +348,14 @@ public class AlignmentView continue; } } + + // clone group properties + nsg[g] = new SequenceGroup(sg); + // may need to shift/trim start and end ? if (r && !viscontigs) { + // Not fully tested code - routine not yet called with viscontigs==false if (nsg[g].getStartRes() < gstart) { nsg[g].setStartRes(0); @@ -360,14 +365,11 @@ public class AlignmentView nsg[g].setStartRes(nsg[g].getStartRes() - gstart); nsg[g].setEndRes(nsg[g].getEndRes() - gstart); } - if (nsg[g].getEndRes() > gend) + if (nsg[g].getEndRes() > (gend-gstart)) { - nsg[g].setEndRes(gend); + nsg[g].setEndRes(gend-gstart); } } - - // clone group properties - nsg[g] = new SequenceGroup(sg); } if (viscontigs) { @@ -989,9 +991,13 @@ public class AlignmentView public static void summariseAlignmentView(AlignmentView view, PrintStream os) { - os.println("View has " + view.sequences.length + " of which " - + (view.selected == null ? "None" : view.selected.size()) - + " are selected."); + os.print("View has " + view.sequences.length + " of which "); + if (view.selected == null) { + os.print("None"); + } else { + os.print(" "+view.selected.size()); + } + os.println(" are selected."); os.print("View is " + view.getWidth() + " columns wide"); int viswid = 0; int[] contigs = view.getContigs(); @@ -1038,12 +1044,10 @@ public class AlignmentView + " wide and has " + visal.getHeight() + " seqs."); if (visal.getGroups() != null && visal.getGroups().size() > 0) { - SequenceGroup sg; - Enumeration en = visal.getGroups().elements(); + int i = 1; - while (en.hasMoreElements()) + for (SequenceGroup sg:visal.getGroups()) { - sg = (SequenceGroup) en.nextElement(); os.println("Group " + (i++) + " begins at column " + sg.getStartRes() + " and ends at " + sg.getEndRes()); }