[Biojava-l] A problem in reading remote AB1 files
Hüseyin Kaya
hkayabilisim at gmail.com
Mon Apr 20 14:14:03 UTC 2009
Hi BioJava Community,
I have a little problem in reading AB1 files residing on a
remote webserver.
I have two different AB1 files; ok.ab1 and failed.ab1.
They were both generated from the same sequencer.
Here is a quick summary:
Reading ok.ab1 from a local directory is OK
Reading failed.ab1 from a local directory is OK
Reading ok.ab1 from a remote webserver is OK
Reading failed.ab1 from a remote webserver is not OK
The exception is:
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.biojava.utils.io.CachingInputStream.read(CachingInputStream.java:101)
at java.io.DataInputStream.readFully(Unknown Source)
at java.io.DataInputStream.readFully(Unknown Source)
at
org.biojava.bio.program.abi.ABIFParser$DataStream.readFully(ABIFParser.java:376)
at
org.biojava.bio.program.abi.ABIFParser.readDataRecords(ABIFParser.java:129)
at org.biojava.bio.program.abi.ABIFParser.<init>(ABIFParser.java:100)
at org.biojava.bio.program.abi.ABIFParser.<init>(ABIFParser.java:89)
at
org.biojava.bio.program.abi.ABIFChromatogram$Parser.<init>(ABIFChromatogram.java:117)
at
org.biojava.bio.program.abi.ABIFChromatogram.load(ABIFChromatogram.java:101)
at
org.biojava.bio.program.abi.ABIFChromatogram.create(ABIFChromatogram.java:89)
at
org.biojava.bio.chromatogram.ChromatogramFactory.create(ChromatogramFactory.java:119)
at BugTest.readChromatogram(BugTest.java:34)
at BugTest.main(BugTest.java:22)
I will be glad if you help me in resolving this problem.
Sincerely
Huseyin Kaya
BugTest.java
import java.net.URL;
import org.biojava.bio.chromatogram.AbstractChromatogram;
import org.biojava.bio.chromatogram.ChromatogramFactory;
public class BugTest
{
public static final String URL_REMOTE_FAILED = "
http://dna.iontek.com.tr/files/failed.ab1";
public static final String URL_REMOTE_OK = "
http://dna.iontek.com.tr/files/ok.ab1";
public static final String URL_LOCAL_FAILED = "file:///C:/failed.ab1";
public static final String URL_LOCAL_OK = "file:///C:/ok.ab1";
public static void main(String[] args) throws Exception
{
readChromatogram("Reading ok.ab1 from local directory",URL_LOCAL_OK);
readChromatogram("Reading failed.ab1 from local
directory",URL_LOCAL_FAILED);
readChromatogram("Reading ok.ab1 from webserver ",URL_REMOTE_OK);
// This one is failed
readChromatogram("Reading failed.ab1 from webserver
",URL_REMOTE_FAILED);
}
private static void readChromatogram(String message, String urlstr)
{
System.out.println(message + "["+urlstr+"]");
AbstractChromatogram ch = null ;
URL url;
try
{
url = new URL(urlstr);
ch = (AbstractChromatogram)ChromatogramFactory.create(url.openStream());
} catch (Exception e)
{
e.printStackTrace();
}
if (ch != null)
System.out.println("Trace length is "+ch.getTraceLength());
}
}
More information about the Biojava-l
mailing list