[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> </DIV>
<DIV><FONT face=3DArial size=3D2>Ramana</FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>public class GCContent =
{<BR> =20
public static void main(String[]=20
args)<BR> throws=20
Exception<BR> =
{<BR> =20
if (args.length !=3D 1)<BR> throw new =
Exception("usage:=20
java GCContent filename.fa");<BR> String fileName =3D=20
args[0];<BR> =20
System.out.println("FileName"+fileName);<BR> // Set up sequence=20
iterator</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> BufferedReader br =3D new=20
BufferedReader(<BR> =
=20
new FileReader(fileName));<BR> System.out.println("File=20
opened..............");<BR> SequenceIterator stream =3D=20
SeqIOTools.readFastaDNA(br);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> // Iterate over all sequences in =
the=20
stream</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> while (stream.hasNext())=20
{<BR> Sequence seq =3D=20
stream.nextSequence();<BR> int gc =3D=20
0;<BR> for (int pos =3D 1; pos <=3D =
seq.length(); ++pos)=20
{<BR> Symbol sym =3D seq.symbolAt(pos);<BR> if =
(sym =3D=3D=20
DNATools.g() || sym =3D=3D =
DNATools.c())<BR> =20
++gc;<BR> }<BR> =20
System.out.println(seq.getName() + ": " +=20
<BR> ((gc * 100.0) =
/=20
seq.length()) + "%");<BR> }<BR> =20
} =
<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> </DIV></FONT></BODY></HTML>
------=_NextPart_000_0005_01C121C5.F5A3A120--