X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceFetcher.java;h=2beb3d95dfa5d58b14bbbdf62c299c413bf68b24;hb=7f7fc2e5533f7b00c86465f964e37c55bcf12fd7;hp=7b255315a03ed129f9e914938ad1163e8ce4a232;hpb=e02486484d33e20dedb020a34f31f6024d5720a2;p=jalview.git diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 7b25531..2beb3d9 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -119,8 +119,8 @@ public class SequenceFetcher new Insets(0, 4, 0, 0), 1, 0)); this.add(textfield, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, - GridBagConstraints.HORIZONTAL, - new Insets(0, 0, 0, 6), 200, 1)); + GridBagConstraints.NONE, + new Insets(0, 0, 0, 6), 211, 1)); } JComboBox database = new JComboBox(); @@ -183,16 +183,26 @@ public class SequenceFetcher else if (database.getSelectedItem().equals("EMBL") || database.getSelectedItem().equals("EMBLCDS")) { - EBIFetchClient dbFetch = new EBIFetchClient(); - String[] reply = dbFetch.fetchData( - database.getSelectedItem().toString().toLowerCase( - ) + ":" + textfield.getText(), - "fasta", "raw"); + StringTokenizer st = new StringTokenizer(textfield.getText(), ";"); + while(st.hasMoreTokens()) + { + EBIFetchClient dbFetch = new EBIFetchClient(); + + String[] reply = dbFetch.fetchData( + database.getSelectedItem().toString().toLowerCase( + ) + ":" + st.nextToken(), + "fasta", "raw"); +// + if (reply != null) + { + for (int i = 0; i < reply.length; i++) + result.append(reply[i] + "\n"); + } + } - if(reply!=null) + if(result!=null) { - for (int i = 0; i < reply.length; i++) - result.append(reply[i] + "\n"); + System.out.println(result.toString()); parseResult(result.toString(), null); } @@ -239,9 +249,9 @@ public class SequenceFetcher { EBIFetchClient ebi = new EBIFetchClient(); File file = ebi.fetchDataAsFile("uniprot:" + id, "xml", null); - // File file = new File("H:/jalview/classes/fer1.xml"); - SequenceFeatureFetcher sff = new SequenceFeatureFetcher(); - Vector entries = sff.getUniprotEntries(file); + + DBRefFetcher dbref = new DBRefFetcher(); + Vector entries = dbref.getUniprotEntries(file); if (entries != null) { @@ -291,6 +301,17 @@ public class SequenceFetcher onlyPdbEntries.addElement(pdb); } + Enumeration en2 = entry.getAccession().elements(); + while (en2.hasMoreElements()) + { + sequence[i].getDatasetSequence().addDBRef(new DBRefEntry(DBRefSource.UNIPROT, + "0", + en2.nextElement().toString())); + } + + + + sequence[i].getDatasetSequence().setPDBId(onlyPdbEntries); if (entry.getFeature() != null) { @@ -317,17 +338,18 @@ public class SequenceFetcher } EBIFetchClient ebi = new EBIFetchClient(); - String[] reply = ebi.fetchData("pdb:" + id, "pdb", "raw"); - if (reply == null) + String file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath(); + if (file == null) return null; try { - PDBfile pdbfile = new PDBfile(reply); + PDBfile pdbfile = new PDBfile(file, jalview.io.AppletFormatAdapter.FILE); for (int i = 0; i < pdbfile.chains.size(); i++) { if (chain == null || ( (PDBChain) pdbfile.chains.elementAt(i)).id. toUpperCase().equals(chain)) + result.append("\n>PDB|" + id + "|" + ( (PDBChain) pdbfile.chains.elementAt(i)).sequence. getName() + @@ -353,7 +375,7 @@ public class SequenceFetcher String format = new IdentifyFile().Identify(result, "Paste"); SequenceI[] sequences = null; - if (FormatAdapter.formats.contains(format)) + if (FormatAdapter.isValidFormat(format)) { sequences = null; try{ sequences = new FormatAdapter().readFile(result.toString(), "Paste", @@ -364,15 +386,19 @@ public class SequenceFetcher { if (alignFrame == null) { - AlignFrame af = new AlignFrame(new Alignment(sequences)); + AlignFrame af = new AlignFrame(new Alignment(sequences), + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT +); af.currentFileFormat = format; if(title==null) title = "Retrieved from " + database.getSelectedItem(); Desktop.addInternalFrame(af, title, - AlignFrame.NEW_WINDOW_WIDTH, - AlignFrame.NEW_WINDOW_HEIGHT); + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); af.statusBar.setText("Successfully pasted alignment file"); + try { af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false)); @@ -431,7 +457,7 @@ public class SequenceFetcher // We make a DBRefEtntry because we have obtained the PDB file from a verifiable source // JBPNote - PDB DBRefEntry should also carry the chain and mapping information - DBRefEntry dbentry = new DBRefEntry("PDB","0",pdbid); + DBRefEntry dbentry = new DBRefEntry(jalview.datamodel.DBRefSource.PDB,"0",pdbid); sequences[i].getDatasetSequence().addDBRef(dbentry); } else