Question: using SAMTOOLs API i am trying to get BAM ...follwing Excption occur..How to Handle it Any suggestion...
0
gravatar for mnmujawar007
3.7 years ago by
mnmujawar0070 wrote:

i am Writing Following Method to get Seq..but it throws Exception....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)

 

ADD COMMENTlink modified 3.6 years ago by Istvan Albert ♦♦ 80k • written 3.7 years ago by mnmujawar0070

give us the full strack trace and the line numbers.
 

ADD REPLYlink written 3.7 years ago by Pierre Lindenbaum120k

i already provide stacktrace

ADD REPLYlink written 3.6 years ago by mnmujawar0070
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1799 users visited in the last hour