[Biojava-l] Help

RAMANA ramana@galainfotek.com
Fri, 10 Aug 2001 17:57:45 +1000


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C121C5.F5A3A120
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello This is ramana from GalaInfotek,
please go through the programme, i am compiling th eprogram successfully =
but i am getting a run time error, do if you can tell the reason for the =
error this will of very great help for me.
hoping that you would do the needy.
Thanking you

Ramana

Programme
---------------------
import java.io.*;
import org.biojava.bio.symbol.*;
import org.biojava.bio.seq.*;
import org.biojava.bio.seq.io.*;

public class GCContent {
    public static void main(String[] args)
        throws Exception
    {
        if (args.length !=3D 1)
     throw new Exception("usage: java GCContent filename.fa");
 String fileName =3D args[0];
       System.out.println("FileName"+fileName);
 // Set up sequence iterator

 BufferedReader br =3D new BufferedReader(
           new FileReader(fileName));
 System.out.println("File opened..............");
 SequenceIterator stream =3D SeqIOTools.readFastaDNA(br);

 // Iterate over all sequences in the stream

 while (stream.hasNext()) {
     Sequence seq =3D stream.nextSequence();
     int gc =3D 0;
     for (int pos =3D 1; pos <=3D seq.length(); ++pos) {
  Symbol sym =3D seq.symbolAt(pos);
  if (sym =3D=3D DNATools.g() || sym =3D=3D DNATools.c())
      ++gc;
     }
     System.out.println(seq.getName() + ": " +=20
          ((gc * 100.0) / seq.length()) +  "%");
 }
    }         =20
}

Runtime Error:
-------------------------


------=_NextPart_000_0005_01C121C5.F5A3A120
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 This is ramana from =
GalaInfotek,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>please go through the programme, i am =
compiling th=20
eprogram successfully but i am getting a run time error, do if you can =
tell the=20
reason for the error this will of very great help for me.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>hoping that you would do the =
needy.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanking you</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ramana</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Programme</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>---------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>import java.io.*;<BR>import=20
org.biojava.bio.symbol.*;<BR>import org.biojava.bio.seq.*;<BR>import=20
org.biojava.bio.seq.io.*;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class GCContent =
{<BR>&nbsp;&nbsp;&nbsp;=20
public static void main(String[]=20
args)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws=20
Exception<BR>&nbsp;&nbsp;&nbsp; =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if (args.length !=3D 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp; throw new =
Exception("usage:=20
java GCContent filename.fa");<BR>&nbsp;String fileName =3D=20
args[0];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
System.out.println("FileName"+fileName);<BR>&nbsp;// Set up sequence=20
iterator</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;BufferedReader br =3D new=20
BufferedReader(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
new FileReader(fileName));<BR>&nbsp;System.out.println("File=20
opened..............");<BR>&nbsp;SequenceIterator stream =3D=20
SeqIOTools.readFastaDNA(br);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;// Iterate over all sequences in =
the=20
stream</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;while (stream.hasNext())=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp; Sequence seq =3D=20
stream.nextSequence();<BR>&nbsp;&nbsp;&nbsp;&nbsp; int gc =3D=20
0;<BR>&nbsp;&nbsp;&nbsp;&nbsp; for (int pos =3D 1; pos &lt;=3D =
seq.length(); ++pos)=20
{<BR>&nbsp;&nbsp;Symbol sym =3D seq.symbolAt(pos);<BR>&nbsp;&nbsp;if =
(sym =3D=3D=20
DNATools.g() || sym =3D=3D =
DNATools.c())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
++gc;<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
System.out.println(seq.getName() + ": " +=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((gc * 100.0) =
/=20
seq.length()) +&nbsp; "%");<BR>&nbsp;}<BR>&nbsp;&nbsp;&nbsp;=20
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Runtime Error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT></BODY></HTML>

------=_NextPart_000_0005_01C121C5.F5A3A120--