[DAS] DAS

Ethan Cerami ecerami@yahoo.com
Mon, 23 Dec 2002 08:32:26 -0800 (PST)


Hi,

I believe this is a Java IO issue.  When you call:

int bytes = reader.read(buff,0,20000);

the API does not guarantee that the full buffer is
actually filled, so you only get a portion of the
document.  You also have the problem that you may
overflow the buffer with very large DAS responses (and
the DAS request you are issuing results in a very
large document).

Since you are already using BufferedReader, try this:

        String line = reader.readLine();
        while (line != null) {
            System.out.println (line);
            line = reader.readLine();
        }

I tried this on machine with your code, and was able
to read in the full DAS response.

Ethan


--- Saju Joseph <saju_peruvachira@hotmail.com> wrote:
> Hi Jansen, 
>     I would like to retrieve the feature types(
> Annotation) available for a segment. Below is the
> code segment I used to retrieve XML information from
> DAS severs. But due to some unforeseen reasons, I am
> getting only a small portion from the beginning of
> XML document. It will be apreciated if you could
> provide me with some insight into rectifying this.
> 
>             String urlString =
>
"http://genome.cse.ucsc.edu/cgi-bin/das/hg10/features?segment=chr1:1,19000";
> 
>            //Connect to the url
>            URL url = new URL(urlString);
>            HttpURLConnection conn =
> (HttpURLConnection) url.openConnection();
> 
>            //Set Http request properties
>            conn.setDoOutput(true);
>            conn.setDoInput(true);
>            conn.setRequestMethod("GET");
>           
> conn.setRequestProperty("Content-Language",
> "en-US");
>            conn.setRequestProperty("Content-Type",
> "application/xml");
> 
>            //Write data
>            OutputStream out =
> conn.getOutputStream();
>            out.flush();
> 
>            //Read data
>            BufferedReader reader = new
> BufferedReader(new
> InputStreamReader(conn.getInputStream()));
>           
>            char[] buff = new char[20000];
>            
>             int bytes = reader.read(buff,0,20000);
> 
>             String strResult = new String(buff);
>             System.out.println(strResult);
> 
>             out.close();
>             conn.disconnect();]
> 
> Thaks in advance,
> Saju Joseph
> 
> 
>   ----- Original Message ----- 
>   From: Thorsten Jansen 
>   To: Saju Joseph 
>   Cc: DAS 
>   Sent: Friday, December 20, 2002 3:57 PM
>   Subject: RE: [DAS] DAS
> 
> 
>   Hi,
> 
>   The biojava library contains classes for
> connecting to the das server and for converting the
> results. They should provide everything you need.
> 
>   Hope that helps
>   Thorsten Jansen
>     -----Original Message-----
>     From: das-admin@biodas.org
> [mailto:das-admin@biodas.org]On Behalf Of Saju
> Joseph
>     Sent: Friday, December 20, 2002 8:07 AM
>     To: das@biodas.org
>     Subject: [DAS] DAS
> 
> 
>     Gurus,
>     We have implemented a genome browser. We would
> like to download external genome annotation data
> from the DAS servers with minimum effort. With an
> http Request made to the DAS server, XML data will
> be obtained. How is it possible to convert this XML
> data using the DAS standard. If any of you could
> provide me with a detailed input on this, it is
> highly appreciatable.
>     Thanks in advance,
>     Saju Joseph
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com