[DAS] DAS Client
Saju Joseph
saju_peruvachira@hotmail.com
Mon, 6 Jan 2003 15:49:22 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_015B_01C2B59B.2E6DA090
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Gurus,=20
I want to get the sequence for a chromosome region. Below is the piece =
of code I tried, and am struck in between. Can any of you help me. Other =
suggestions are welcome.
//Connect to the url
URL url =3D new =
URL("http://genome.cse.ucsc.edu/cgi-bin/das/hg8/dna?segment=3Dchr1:1,100;=
segment=3Dchr2:2,300");
HttpURLConnection conn =3D (HttpURLConnection) =
url.openConnection();
=20
//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");
System.out.println("DAS Data Requested...");
//Read data
BufferedReader reader =3D new BufferedReader(new =
InputStreamReader(conn.getInputStream()));
char[] buff =3D new char[20000];
int bytes;
String strFull =3D "";
while (true){
bytes =3D reader.read(buff,0,20000);
if (bytes =3D=3D -1) break;
=20
String str =3D new String (buff, 0, bytes);
=20
strFull =3D strFull + str;
}
=20
System.out.println(strFull);=20
SequenceIterator stream =3D =
(SequenceIterator)SeqIOTools.readEmbl(reader);
=20
//Iterate over all sequences in the stream
while (stream.hasNext()) {
Sequence seq =3D stream.nextSequence();
System.out.println(seq.getName());=20
}
Also I want to print the entire Sequence onto the console. How do I =
achieve this. Can any of you direct me to any samples.
Regards,
Saju Joseph
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
------=_NextPart_000_015B_01C2B59B.2E6DA090
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2>Hi=20
Gurus, </FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2>I want=20
to get the sequence for a chromosome region. Below is the piece of code =
I tried,=20
and am struck in between. Can any of you help me. Other suggestions are=20
welcome.</FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002></SPAN> </DIV>
<DIV><SPAN =
class=3D761372410-20122002> =20
//Connect to the url</SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002> =
URL=20
url =3D new URL("<FONT color=3D#0000ff><U><A=20
href=3D"http://genome.cse.ucsc.edu/cgi-bin/das/hg8/dna?segment=3Dchr1:1,1=
00;segment=3Dchr2:2,300">http://genome.cse.ucsc.edu/cgi-bin/das/hg8/dna?s=
egment=3Dchr1:1,100;segment=3Dchr2:2,300</A></U></FONT>");<BR>  =
; =20
HttpURLConnection conn =3D (HttpURLConnection)=20
url.openConnection();</SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002></SPAN><SPAN=20
class=3D761372410-20122002> =20
</SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002> =
//Set=20
Http request properties<BR> =20
conn.setDoOutput(true);<BR> =20
conn.setDoInput(true);<BR> =20
conn.setRequestMethod("GET");<BR> &nbs=
p;=20
conn.setRequestProperty("Content-Language",=20
"en-US");<BR> =20
conn.setRequestProperty("Content-Type",=20
"application/xml");<BR> =20
System.out.println("DAS Data Requested...");<BR></SPAN><SPAN=20
class=3D761372410-20122002></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002> =
//Read=20
data<BR> BufferedReader =
reader =3D=20
new BufferedReader(new =
InputStreamReader(conn.getInputStream()));</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=3D761372410-20122002> =
char[] buff=20
=3D new char[20000];<BR> int=20
bytes;<BR> String strFull =3D=20
"";<BR> while=20
(true){<BR> =
bytes =3D=20
reader.read(buff,0,20000);<BR> =
=20
if (bytes =3D=3D -1) break;<BR> =20
<BR> String str =3D new =
String=20
(buff, 0, bytes);<BR> =20
<BR> strFull =3D =
strFull +=20
str;<BR> }<BR> <BR>&n=
bsp; =20
System.out.println(strFull); </SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002> =
SequenceIterator stream =3D=20
(SequenceIterator)SeqIOTools.readEmbl(reader);<BR>  =
; <BR> //Iterate=20
over all sequences in the stream</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=3D761372410-20122002> while =
(stream.hasNext())=20
{<BR> Sequence seq =3D=20
stream.nextSequence();<BR> </SPA=
N><SPAN=20
class=3D761372410-20122002>System.out.println(seq.getName()); </SPAN=
></DIV>
<DIV><SPAN class=3D761372410-20122002>}</SPAN></DIV><SPAN=20
class=3D761372410-20122002></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D761372410-20122002></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D761372410-20122002><SPAN=20
class=3D761372410-20122002><FONT color=3D#0000ff>Also I want to print =
the entire=20
Sequence onto the console. How do I achieve this. Can any of you direct =
me to=20
any samples.</FONT></SPAN><BR></DIV></SPAN>
<DIV><SPAN class=3D761372410-20122002></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002></SPAN><SPAN =
class=3D761372410-20122002><FONT=20
color=3D#0000ff>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002><FONT color=3D#0000ff>Saju=20
Joseph</FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT=20
color=3D#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT=20
color=3D#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT=20
color=3D#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT=20
color=3D#0000ff></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2>The=20
biojava library contains classes for connecting to the das server and =
for=20
converting the results. They should provide everything you=20
need.</FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2>Hope=20
that helps</FONT></SPAN></DIV>
<DIV><SPAN class=3D761372410-20122002><FONT face=3DArial color=3D#0000ff =
size=3D2>Thorsten Jansen</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> =
das-admin@biodas.org=20
[mailto:das-admin@biodas.org]<B>On Behalf Of </B>Saju =
Joseph<BR><B>Sent:</B>=20
Friday, December 20, 2002 8:07 AM<BR><B>To:</B>=20
das@biodas.org<BR><B>Subject:</B> [DAS] DAS<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Gurus,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>We have implemented a genome browser. =
We would=20
like to download external genome annotation data from the DAS servers =
with=20
minimum effort. With an http Request made to the DAS server, XML data =
will be=20
obtained. How is it possible to convert this XML data using the DAS =
standard.=20
If any of you could provide me with a detailed input on this, it is =
highly=20
appreciatable.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Saju=20
Joseph</FONT></DIV></BLOCKQUOTE></FONT></BODY></HTML>
------=_NextPart_000_015B_01C2B59B.2E6DA090--