diff --git a/uk/ac/sanger/artemis/components/RunPfamSearch.java b/uk/ac/sanger/artemis/components/RunPfamSearch.java deleted file mode 100644 index cb6eda42b2e6f4cfd3fb08f2dec35b03f0b2f18b..0000000000000000000000000000000000000000 --- a/uk/ac/sanger/artemis/components/RunPfamSearch.java +++ /dev/null @@ -1,101 +0,0 @@ -/* RunPfamSearch.java - * - * created: 2009 - * - * This file is part of Artemis - * - * Copyright(C) 2009 Genome Research Limited - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or(at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - **/ - -package uk.ac.sanger.artemis.components; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLEncoder; - -import uk.ac.sanger.artemis.editor.BrowserControl; - -public class RunPfamSearch -{ - private static String pfamUrl = "http://pfam.sanger.ac.uk/search/sequence"; - - public RunPfamSearch(final String residues) - { - postData(residues); - } - - public void postData(final String residues) - { - try - { - // Construct data - String data = URLEncoder.encode("seq", "UTF-8") + "=" - + URLEncoder.encode(residues, "UTF-8"); - data += "&" + URLEncoder.encode("output", "UTF-8") + "=" - + URLEncoder.encode("xml", "UTF-8"); - - // Send data - URL url = new URL(pfamUrl); - URLConnection conn = url.openConnection(); - conn.setDoOutput(true); - OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); - wr.write(data); - wr.flush(); - - // Get the response - BufferedReader rd = new BufferedReader( - new InputStreamReader(conn.getInputStream())); - String urlResults = "http://pfam.sanger.ac.uk/search/sequence/results?"; - String line; - String eta = "10"; - while ((line = rd.readLine()) != null) - { - int index; - if((index = line.indexOf("jobId=")) > -1) - { - urlResults = urlResults.concat(line.substring(index)); - } - else if((index = line.indexOf("<estimated_time>")) > -1) - { - eta = line.substring(index+16); - index = eta.indexOf("<"); - if(index > -1) - eta = eta.substring(0, index); - } - } - wr.close(); - rd.close(); - - URL result = new URL(urlResults); - Thread.sleep(Integer.parseInt(eta)*1000); - - while(((HttpURLConnection) result.openConnection()).getResponseCode() == 204) - Thread.sleep(1000); - - BrowserControl.displayURL(urlResults); - } - catch (Exception e) - { - } - - } -} \ No newline at end of file