X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignFrame.java;h=b6324423a0f9384364fd178391440860bf2e22b1;hb=783520af519c958e10a2af29f1d4242e1ab890a3;hp=0f275dee19c4984385b8be614b2566e1d7caeee6;hpb=04b6d995eb9395cb4107b28119fff413d8bacafd;p=jalview.git diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 0f275de..b632442 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -29,6 +29,7 @@ import java.awt.event.*; import java.util.*; import java.io.InputStreamReader; import java.io.BufferedReader; +import java.io.FileReader; public class AlignFrame extends GAlignFrame @@ -55,7 +56,6 @@ public class AlignFrame { try { - treeFile = treeFile; jalview.io.NewickFile fin = new jalview.io.NewickFile(applet. getCodeBase() + treeFile, "URL"); fin.parse(); @@ -140,6 +140,78 @@ public class AlignFrame } + + /** + * DOCUMENT ME! + * + * @param String DOCUMENT ME! + */ + + public void parseGroupsFile(String file) + { + try + { + BufferedReader in = new BufferedReader(new FileReader(file)); + SequenceI seq = null; + String line, text, token; + UserColourScheme ucs; + int index, start, end; + StringTokenizer st; + SequenceGroup sg; + int lineNo = 0; + while ( (line = in.readLine()) != null) + { + lineNo++; + st = new StringTokenizer(line, "\t"); + if (st.countTokens() != 6) + { + System.out.println("Groups file " + file + + " is invalid. Read help file.\nLine: \n" + +lineNo +": "+line); + break; + } + + while (st.hasMoreElements()) + { + text = st.nextToken(); + token = st.nextToken(); + if (!token.equals("ID_NOT_SPECIFIED")) + { + index = viewport.alignment.findIndex(viewport.alignment.findName( + token)); + st.nextToken(); + } + else + { + index = Integer.parseInt(st.nextToken()); + } + + start = Integer.parseInt(st.nextToken()); + end = Integer.parseInt(st.nextToken()); + ucs = new UserColourScheme(st.nextToken()); + + seq = viewport.alignment.getSequenceAt(index); + start = seq.findIndex(start) - 1; + end = seq.findIndex(end) - 1; + + sg = new SequenceGroup(text, ucs, true, true, false, start, end); + sg.addSequence(seq, false); + + viewport.alignment.addGroup(sg); + + } + } + + alignPanel.repaint(); + + } + catch (Exception ex) + { + System.out.println("Error parsing groups file: " + ex); + } + } + + public void inputText_actionPerformed(ActionEvent e) { CutAndPasteTransfer cap = new CutAndPasteTransfer(true, applet); @@ -156,7 +228,7 @@ public class AlignFrame jalview.bin.JalviewLite.addFrame(frame, "Alignment output - " + e.getActionCommand(), 600, 500); - cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), + cap.setText(new AppletFormatAdapter().formatSequences(e.getActionCommand(), viewport.getAlignment(). getSequences())); } @@ -771,7 +843,7 @@ public class AlignFrame public void findMenuItem_actionPerformed(ActionEvent e) { - Finder finder = new Finder(alignPanel); + new Finder(alignPanel); } public void font_actionPerformed(ActionEvent e) @@ -1091,7 +1163,7 @@ public class AlignFrame public void userDefinedColour_actionPerformed(ActionEvent e) { - UserDefinedColours chooser = new UserDefinedColours(alignPanel, null); + new UserDefinedColours(alignPanel, null); } public void PIDColour_actionPerformed(ActionEvent e)