Package net.sf.samtools.util

Examples of net.sf.samtools.util.SeekableStream


    }

    if (filePointers == null || filePointers.length == 0)
      return emptyIterator;

    SeekableStream s = null;
    if (file != null) {
      try {
        s = new SeekableFileStream(file);
      } catch (FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    } else if (is instanceof SeekableStream)
      s = (SeekableStream) is;

    SAMIterator si = null;
    try {
      s.seek(0);
      si = new SAMIterator(s, referenceSequenceFile);
      si.setValidationStringency(validationStringency);
      it = si;
    } catch (IOException e) {
      throw new RuntimeEOFException(e);
    }

    Container c = null;
    for (int i = 0; i < filePointers.length; i += 2) {
      long containerOffset = filePointers[i] >>> 16;
      int sliceIndex = (int) ((filePointers[i] << 48) >>> 48);
      try {
        s.seek(containerOffset);
        // the following is not optimal because this is container-level
        // access, not slice:

        // CountingInputStream cis = new CountingInputStream(s) ;
        c = ReadWrite.readContainerHeader(s);
        // long headerSize = cis.getCount() ;
        // int sliceOffset = c.landmarks[sliceIndex] ;
        if (c.alignmentStart + c.alignmentSpan > start) {
          s.seek(containerOffset);
          // s.seek(containerOffset + headerSize + sliceOffset);
          return si;
        }
      } catch (IOException e) {
        throw new RuntimeException(e);
View Full Code Here


  @Override
  public CloseableIterator<SAMRecord> queryUnmapped() {
    final long startOfLastLinearBin = getIndex().getStartOfLastLinearBin();

    SeekableStream s = null;
    if (file != null) {
      try {
        s = new SeekableFileStream(file);
      } catch (FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    } else if (is instanceof SeekableStream)
      s = (SeekableStream) is;

    SAMIterator si = null;
    try {
      s.seek(0);
      si = new SAMIterator(s, referenceSequenceFile);
      si.setValidationStringency(validationStringency);
      s.seek(startOfLastLinearBin);
      it = si;
    } catch (IOException e) {
      throw new RuntimeEOFException(e);
    }
View Full Code Here

TOP

Related Classes of net.sf.samtools.util.SeekableStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.