From 4f01ddc72d2297c48c57d4f9c25af45b300df154 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 8 Feb 2006 15:27:00 +0000 Subject: [PATCH] parseResult takes the title as string. usually null --- src/jalview/gui/SequenceFetcher.java | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 6d49d12..498489d 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -194,7 +194,7 @@ public class SequenceFetcher for (int i = 0; i < reply.length; i++) result.append(reply[i] + "\n"); - parseResult(result.toString()); + parseResult(result.toString(), null); } } else if (database.getSelectedItem().equals("PDB")) @@ -210,7 +210,7 @@ public class SequenceFetcher if (result.length()>0) - parseResult(result.toString()); + parseResult(result.toString(), null); } else if( database.getSelectedItem().equals("PFAM")) { @@ -221,7 +221,7 @@ public class SequenceFetcher ); if(result.length()>0) - parseResult( result.toString() ); + parseResult( result.toString(), textfield.getText().toUpperCase() ); }catch(java.io.IOException ex) { result = null; } @@ -272,7 +272,7 @@ public class SequenceFetcher } //Then read in the features and apply them to the dataset - SequenceI[] sequence = parseResult(result.toString()); + SequenceI[] sequence = parseResult(result.toString(), null); for (int i = 0; i < entries.size(); i++) { UniprotEntry entry = (UniprotEntry) entries.elementAt(i); @@ -336,23 +336,28 @@ public class SequenceFetcher return result; } - SequenceI[] parseResult(String result) + SequenceI[] parseResult(String result, String title) { String format = IdentifyFile.Identify(result, "Paste"); SequenceI[] sequences = null; if (FormatAdapter.formats.contains(format)) { - sequences = new FormatAdapter().readFile(result.toString(), "Paste", - format); + sequences = null; + try{ sequences = new FormatAdapter().readFile(result.toString(), "Paste", + format);} + catch(Exception ex){} + if (sequences != null && sequences.length > 0) { if (alignFrame == null) { AlignFrame af = new AlignFrame(new Alignment(sequences)); af.currentFileFormat = format; + if(title==null) + title = "Retrieved from " + database.getSelectedItem(); Desktop.addInternalFrame(af, - "Retrieved from " + database.getSelectedItem(), + title, AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT); af.statusBar.setText("Successfully pasted alignment file"); @@ -370,7 +375,7 @@ public class SequenceFetcher alignFrame.viewport.alignment.addSequence(sequences[i]); //////////////////////////// - //Datset needs extension; + //Dataset needs extension; ///////////////////////////// Sequence ds = new Sequence(sequences[i].getName(), AlignSeq.extractGaps("-. ", -- 1.7.10.2