From 008ad05ffd2964c864cdab0f18dff2fb36c82242 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 22 Sep 2005 15:49:51 +0000 Subject: [PATCH] Create instance of FormatAdapter --- src/jalview/appletgui/AlignFrame.java | 2 +- src/jalview/appletgui/CutAndPasteTransfer.java | 2 +- src/jalview/bin/JalviewLite.java | 4 ++-- src/jalview/gui/AlignFrame.java | 6 +++--- src/jalview/gui/CutAndPasteTransfer.java | 2 +- src/jalview/io/FileLoader.java | 2 +- src/jalview/io/FormatAdapter.java | 9 +++++---- src/jalview/jbgui/GFinder.java | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 3da1401..988aadd 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -121,7 +121,7 @@ public class AlignFrame jalview.bin.JalviewLite.addFrame(frame, "Alignment output - " + e.getActionCommand(), 600, 500); - cap.setText(FormatAdapter.formatSequences(e.getActionCommand(), + cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), viewport.getAlignment(). getSequences())); } diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index f8c3756..90bd343 100755 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -74,7 +74,7 @@ public class CutAndPasteTransfer SequenceI[] sequences = null; String format = IdentifyFile.Identify(text, "Paste"); - sequences = FormatAdapter.readFile(text, "Paste", format); + sequences = new FormatAdapter().readFile(text, "Paste", format); if (sequences != null) { diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index c9ec391..75f5991 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -107,7 +107,7 @@ public class JalviewLite extends Applet } String format = jalview.io.IdentifyFile.Identify(args[0],"File"); - SequenceI[] sequences = FormatAdapter.readFile(args[0], "File", format); + SequenceI[] sequences = new FormatAdapter().readFile(args[0], "File", format); if ( (sequences != null) && (sequences.length > 0)) { @@ -228,7 +228,7 @@ public class JalviewLite extends Applet public void run() { SequenceI[] sequences = null; - sequences = FormatAdapter.readFile(file, protocol, format); + sequences = new FormatAdapter().readFile(file, protocol, format); if ((sequences != null) && (sequences.length > 0)) { diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index a020116..9243e99 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -279,7 +279,7 @@ public class AlignFrame } else { - String output = FormatAdapter.formatSequences(format, + String output = new FormatAdapter().formatSequences(format, viewport.getAlignment(). getSequences()); if (output == null) @@ -315,7 +315,7 @@ public class AlignFrame Desktop.addInternalFrame(cap, "Alignment output - " + e.getActionCommand(), 600, 500); - cap.setText(FormatAdapter.formatSequences(e.getActionCommand(), + cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), viewport.getAlignment(). getSequences())); } @@ -685,7 +685,7 @@ public class AlignFrame String str = (String) contents.getTransferData(DataFlavor.stringFlavor); String format = IdentifyFile.Identify(str, "Paste"); - SequenceI[] sequences = FormatAdapter.readFile(str, "Paste", format); + SequenceI[] sequences = new FormatAdapter().readFile(str, "Paste", format); if (newAlignment) diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 10f9777..219ad4b 100755 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -123,7 +123,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer if (FormatAdapter.formats.contains(format)) { - sequences = FormatAdapter.readFile(getText(), "Paste", format); + sequences = new FormatAdapter().readFile(getText(), "Paste", format); } if (sequences != null) diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index e9735ed..26aff08 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -80,7 +80,7 @@ public class FileLoader { if (FormatAdapter.formats.contains(format)) { - sequences = FormatAdapter.readFile(file, protocol, format); + sequences = new FormatAdapter().readFile(file, protocol, format); } if ( (sequences != null) && (sequences.length > 0)) diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 18bf76a..61c2331 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -45,6 +45,8 @@ public class FormatAdapter formats.addElement("PFAM"); } + AlignFile afile = null; + /** * DOCUMENT ME! * @@ -54,12 +56,10 @@ public class FormatAdapter * * @return DOCUMENT ME! */ - public static SequenceI[] readFile(String inFile, String type, String format) + public SequenceI[] readFile(String inFile, String type, String format) { try { - AlignFile afile = null; - if (format.equals("FASTA")) { afile = new FastaFile(inFile, type); @@ -101,6 +101,7 @@ public class FormatAdapter return null; } + /** * DOCUMENT ME! * @@ -109,7 +110,7 @@ public class FormatAdapter * * @return DOCUMENT ME! */ - public static String formatSequences(String format, Vector seqs) + public String formatSequences(String format, Vector seqs) { SequenceI[] s = new SequenceI[seqs.size()]; diff --git a/src/jalview/jbgui/GFinder.java b/src/jalview/jbgui/GFinder.java index 8ece84d..872d490 100755 --- a/src/jalview/jbgui/GFinder.java +++ b/src/jalview/jbgui/GFinder.java @@ -166,7 +166,7 @@ public class GFinder public void run() { String str = textfield.getText(); - SequenceI[] sequences = FormatAdapter.readFile(str, "Paste", "FASTA"); + SequenceI[] sequences = new FormatAdapter().readFile(str, "Paste", "FASTA"); if(sequences!=null && sequences.length>0) { str = jalview.analysis.AlignSeq.extractGaps( -- 1.7.10.2