From 11cfcb7281e45c5958b839e55da66cfbb9582fa7 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 29 Jul 2005 09:39:20 +0000 Subject: [PATCH] Correct label for end res in copy --- src/jalview/appletgui/AlignFrame.java | 83 ++++++++++++++++++++++++++------- src/jalview/gui/AlignFrame.java | 31 ++++++++++-- 2 files changed, 92 insertions(+), 22 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index caa0321..476dbbd 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -80,6 +80,14 @@ public class AlignFrame } } + + if( applet.getParameter("servletAllowed") !=null) + { + ServletGUI plug = new ServletGUI(this, fileMenu, calculateMenu); + } + + + } public void inputText_actionPerformed(ActionEvent e) @@ -278,30 +286,55 @@ public class AlignFrame orderedSeqs.put(index + "", seq); } - int index = 0; + int index = 0, startRes, endRes; + char ch; + for (int i = 0; i < sg.getSize(); i++) { - SequenceI seq = null; - while (seq == null) - { - if (orderedSeqs.containsKey(index + "")) + SequenceI seq = null; + + while (seq == null) { - seq = (SequenceI) orderedSeqs.get(index + ""); - index++; - break; + if (orderedSeqs.containsKey(index + "")) + { + seq = (SequenceI) orderedSeqs.get(index + ""); + index++; + + break; + } + else + { + index++; + } } - else + + //FIND START RES + //Returns residue following index if gap + startRes = seq.findPosition(sg.getStartRes()); + + //FIND END RES + //Need to find the residue preceeding index if gap + endRes = 0; + + for (int j = 0; j < sg.getEndRes()+1 && j < seq.getLength(); j++) + { + ch = seq.getCharAt(j); + if (!jalview.util.Comparison.isGap( (ch))) + { + endRes++; + } + } + + if(endRes>0) { - index++; + endRes += seq.getStart() -1; } - } - copiedSequences.append(seq.getName() + "\t" + - seq.findPosition(sg.getStartRes()) + "\t" - + seq.findPosition(sg.getEndRes()) + "\t" - + - seq.getSequence(sg.getStartRes(), - sg.getEndRes() + 1) + "\n"); + copiedSequences.append(seq.getName() + "\t" + + startRes + "\t" + + endRes + "\t" + + seq.getSequence(sg.getStartRes(), + sg.getEndRes() + 1) + "\n"); } } @@ -1068,7 +1101,21 @@ public class AlignFrame //are the sequences aligned? if (!viewport.alignment.isAligned()) { - return; + SequenceI current; + int Width = viewport.getAlignment().getWidth(); + + for (int i = 0; i < viewport.getAlignment().getSequences().size(); + i++) + { + current = viewport.getAlignment().getSequenceAt(i); + + if (current.getLength() < Width) + { + current.insertCharAt(Width - 1, viewport.getGapCharacter()); + } + } + alignPanel.repaint(); + } final TreePanel tp; diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 3ea7ed0..727e1c6 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -521,7 +521,8 @@ public class AlignFrame extends GAlignFrame orderedSeqs.put(index + "", seq); } - int index = 0; + int index = 0, startRes, endRes; + char ch; for (int i = 0; i < sg.getSize(); i++) { @@ -542,9 +543,31 @@ public class AlignFrame extends GAlignFrame } } + //FIND START RES + //Returns residue following index if gap + startRes = seq.findPosition(sg.getStartRes()); + + //FIND END RES + //Need to find the residue preceeding index if gap + endRes = 0; + + for (int j = 0; j < sg.getEndRes()+1 && j < seq.getLength(); j++) + { + ch = seq.getCharAt(j); + if (!jalview.util.Comparison.isGap( (ch))) + { + endRes++; + } + } + + if(endRes>0) + { + endRes += seq.getStart() -1; + } + buffer.append(seq.getName() + "\t" + - seq.findPosition(sg.getStartRes()) + "\t" + - seq.findPosition(sg.getEndRes()) + "\t" + + startRes + "\t" + + endRes + "\t" + seq.getSequence(sg.getStartRes(), sg.getEndRes() + 1) + "\n"); } @@ -762,7 +785,7 @@ public class AlignFrame extends GAlignFrame sg.addSequence(viewport.getAlignment().getSequenceAt(i), false); } - sg.setEndRes(viewport.alignment.getWidth()); + sg.setEndRes(viewport.alignment.getWidth()-1); viewport.setSelectionGroup(sg); PaintRefresher.Refresh(null, viewport.alignment); } -- 1.7.10.2