using SAMTOOLs API I am trying to get BAM ...follwing Excption occur..How to Handle it Any suggestion...
0
0
Entering edit mode
8.7 years ago

I am writing the following method to get Seq, but it throws an exception. I need help.

private static List<SAMRecord> scan(String chromosome, int start, int end) throws IOException {
    List<SAMRecord> records = new ArrayList<SAMRecord>();
    CloseableIterator<SAMRecord> iter = null;
    try {
      iter = inputSam.query(chromosome, start, (start+70), containsbamRecord);
System.out.println("herer : Floe");
      SAMRecord s=iter.next();
      System.out.println("Value Of Start : "+start+"\t"+"VAlue of End : "+(start+70)+"Value Of iter : "+s.getSAMString());

      while (iter.hasNext()) {
        SAMRecord rec = iter.next();
           //System.out.println("Value Of Start : "+start+"\t"+"VAlue of End : "+end+"Value Of iter : "+rec.get);

        records.add(rec);
      }
      return records;
    } catch (Exception e) {
      throw new IOException(e);
    } finally {
      if (iter != null)
        iter.close();
    }
  }
java.nio.BufferUnderflowException
    at java.nio.Buffer.nextGetIndex(Buffer.java:506)
    at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:677)
    at net.sf.samtools.AbstractBAMFileIndex$MemoryMappedFileBuffer.readInteger(AbstractBAMFileIndex.java:455)
    at net.sf.samtools.AbstractBAMFileIndex.readInteger(AbstractBAMFileIndex.java:406)
    at net.sf.samtools.AbstractBAMFileIndex.query(AbstractBAMFileIndex.java:266)
    at net.sf.samtools.DiskBasedBAMFileIndex.getSpanOverlapping(DiskBasedBAMFileIndex.java:60)
    at net.sf.samtools.BAMFileReader.createIndexIterator(BAMFileReader.java:719)
    at net.sf.samtools.BAMFileReader.query(BAMFileReader.java:369)
    at net.sf.samtools.SAMFileReader.query(SAMFileReader.java:381)
    at WrapperMain.scan(WrapperMain.java:85)
    at WrapperMain.getDataforPosition(WrapperMain.java:119)
htsjdk sequence java alignment • 1.8k views
ADD COMMENT
0
Entering edit mode

Give us the full stack trace and the line numbers.

ADD REPLY
0
Entering edit mode

I already provided stacktrace

ADD REPLY

Login before adding your answer.

Traffic: 1693 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6