[Biojava-l] Doubt

Ramana ramana@galainfotek.com
Fri, 17 Aug 2001 11:23:36 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C1270F.0E5DB720
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello=20
This ramana from GalaInfotek,
in follwing code you used openDb method but i did'nt find any where in
through out superclasses and implemented interfaces of  =
IndexedSequenceDB.
IndexedSequenceDB.openDB(dbName)

 import java.io.*;
import javax.servlet.*;
import javac.servlet.http.*;
import org.biojava.bio.symbol.*;
import org.biojava.bio.seq.*;
import org.biojava.bio.seq.io.*;
import org.biojava.bio.seq.db.*;

public class SequenceServlet extends HttpServlet {
    private SequenceDB indexedDB;      // Database to serve
    private SequenceFormat seqFormat;  // Used for writing

    public void init(ServletConfig config)
        throws ServletException
    {
        super.init(config);
 String dbName =3D config.getInitParameter("sequence.db");
 if (dbName =3D=3D null)
     throw new ServletException("Database not specified");
 try {
     indexedDB =3D IndexedSequenceDB.openDB(dbName);
        } catch (Exception ex) {
     log("Can't open sequence database: " + dbName, ex);
     throw new ServletException();
        }

 seqFormat =3D new FastaFormat();
    }

    public void doGet(HttpServletRequest req,
                      HttpServletResponse resp)
        throws ServletException, IOException
    {
        String id =3D req.getParameter("id");
 if (id =3D=3D null) {
     resp.sendError(HttpServletResponse.SC_NOT_FOUND,
                    "No id parameter in request");
            return;
 }

 try {
     Sequence seq =3D indexedDB.getSequence(id);
     resp.setContentType("text/plain");
     PrintStream stream =3D new PrintStream(resp.getOutputStream());
     seqFormat.writeSequence(seq, stream);
        } catch (BioException ex) {
     log("Can't retrieve sequence", ex);
     resp.sendError(HttpServletResponse.SC_NOT_FOUND,
                    "Couldn't load sequence " + id);
        }
    }
}
and one more thing
you used a class FastaDescriptionReader in some where ,but i did'nt find
this class......
can u plz check it and send the solution
bye
RAMANA


------=_NextPart_000_0009_01C1270F.0E5DB720
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 content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello <BR>This ramana from =
GalaInfotek,<BR>in=20
follwing code you used openDb method but i did'nt find any where =
in<BR>through=20
out superclasses and implemented interfaces of&nbsp;=20
IndexedSequenceDB.<BR>IndexedSequenceDB.openDB(dbName)<BR><BR>&nbsp;impor=
t=20
java.io.*;<BR>import javax.servlet.*;<BR>import =
javac.servlet.http.*;<BR>import=20
org.biojava.bio.symbol.*;<BR>import org.biojava.bio.seq.*;<BR>import=20
org.biojava.bio.seq.io.*;<BR>import =
org.biojava.bio.seq.db.*;<BR><BR>public=20
class SequenceServlet extends HttpServlet {<BR>&nbsp;&nbsp;&nbsp; =
private=20
SequenceDB indexedDB;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Database to=20
serve<BR>&nbsp;&nbsp;&nbsp; private SequenceFormat seqFormat;&nbsp; // =
Used for=20
writing<BR><BR>&nbsp;&nbsp;&nbsp; public void init(ServletConfig=20
config)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws=20
ServletException<BR>&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
super.init(config);<BR>&nbsp;String dbName =3D=20
config.getInitParameter("sequence.db");<BR>&nbsp;if (dbName =3D=3D=20
null)<BR>&nbsp;&nbsp;&nbsp;&nbsp; throw new ServletException("Database =
not=20
specified");<BR>&nbsp;try {<BR>&nbsp;&nbsp;&nbsp;&nbsp; indexedDB =3D=20
IndexedSequenceDB.openDB(dbName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
} catch (Exception ex) {<BR>&nbsp;&nbsp;&nbsp;&nbsp; log("Can't open =
sequence=20
database: " + dbName, ex);<BR>&nbsp;&nbsp;&nbsp;&nbsp; throw new=20
ServletException();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR><BR>&nbsp;seqFormat =3D new FastaFormat();<BR>&nbsp;&nbsp;&nbsp;=20
}<BR><BR>&nbsp;&nbsp;&nbsp; public void doGet(HttpServletRequest=20
req,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
HttpServletResponse resp)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
throws=20
ServletException, IOException<BR>&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String id =3D=20
req.getParameter("id");<BR>&nbsp;if (id =3D=3D null) =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
resp.sendError(HttpServletResponse.SC_NOT_FOUND,<BR>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
"No id parameter in=20
request");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
return;<BR>&nbsp;}<BR><BR>&nbsp;try {<BR>&nbsp;&nbsp;&nbsp;&nbsp; =
Sequence seq =3D=20
indexedDB.getSequence(id);<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
resp.setContentType("text/plain");<BR>&nbsp;&nbsp;&nbsp;&nbsp; =
PrintStream=20
stream =3D new =
PrintStream(resp.getOutputStream());<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
seqFormat.writeSequence(seq,=20
stream);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch =
(BioException ex)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp; log("Can't retrieve sequence",=20
ex);<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
resp.sendError(HttpServletResponse.SC_NOT_FOUND,<BR>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
"Couldn't load sequence " + =
id);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR>and one more thing<BR>you used a class =

FastaDescriptionReader in some where ,but i did'nt find<BR>this=20
class......<BR>can u plz check it and send the=20
solution<BR>bye<BR>RAMANA<BR></FONT></DIV></BODY></HTML>

------=_NextPart_000_0009_01C1270F.0E5DB720--