Package net.sf.cram.structure

Examples of net.sf.cram.structure.CompressionHeaderBLock


      throws IOException {

    long time1 = System.nanoTime();
    ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream();

    Block block = new CompressionHeaderBLock(c.h);
    block.write(baos);
    c.blockCount = 1;

    List<Integer> landmarks = new ArrayList<Integer>();
    SliceIO sio = new SliceIO();
    for (int i = 0; i < c.slices.length; i++) {
View Full Code Here


    long time1 = System.nanoTime();
    Container c = readContainerHeader(is);
    if (c == null) return null ;

    CompressionHeaderBLock chb = new CompressionHeaderBLock(is);
    c.h = chb.getCompressionHeader();
    howManySlices = Math.min(c.landmarks.length, howManySlices);

    if (fromSlice > 0)
      is.skip(c.landmarks[fromSlice]);
View Full Code Here

    ContainerHeaderIO chio = new ContainerHeaderIO();
    chio.readContainerHeader(container, stream);
    assertNotNull(container);
    System.out.println(container);

    CompressionHeaderBLock chb = new CompressionHeaderBLock(stream);
    container.h = chb.getCompressionHeader();

    assertNotNull(container.h);
    System.out.println(container.h);

    SliceIO sio = new SliceIO();
    container.slices = new Slice[container.landmarks.length];
    for (int s = 0; s < container.landmarks.length; s++) {
      Slice slice = new Slice();
      sio.read(slice, stream);
      container.slices[s] = slice;
    }

    System.out.println(container);

    ArrayList<CramRecord> records = new ArrayList<CramRecord>(
        container.nofRecords);
    BLOCK_PROTO.getRecords(container.h, container,
        cramHeader.samFileHeader, records);
   
    testALignmentSpan(container, cramHeader, records);

    for (int i = 0; i < records.size(); i++) {
      if (i < 10)
        System.out.println(records.get(i).toString());
    }

    ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(
        BYTES);
    ReadWrite.writeCramHeader(cramHeader, baos);
    byte[] b = baos.toByteArray();
    ByteArrayInputStream bais = new ByteArrayInputStream(b);
    CramHeader cramHeader2 = ReadWrite.readCramHeader(bais);
    assertEquals(toString(cramHeader.samFileHeader),
        toString(cramHeader2.samFileHeader));

    BLOCK_PROTO.recordsPerSlice = container.slices[0].nofRecords;

    Container container2 = BLOCK_PROTO.buildContainer(records,
        cramHeader.samFileHeader, true, 0, container.h.substitutionMatrix, true);
    for (int i = 0; i < container.slices.length; i++) {
      container2.slices[i].refMD5 = container.slices[i].refMD5;
    }

    ReadWrite.writeContainer(container2, baos);

    bais = new ByteArrayInputStream(baos.toByteArray());

    cramHeader2 = ReadWrite.readCramHeader(bais);
    assertNotNull(cramHeader);
    assertNotNull(cramHeader.samFileHeader);
    assertEquals(2, cramHeader.majorVersion);
    assertEquals(0, cramHeader.minorVersion);

    Container container3 = new Container();
    chio.readContainerHeader(container3, bais);
    assertNotNull(container3);
    System.out.println(container3);

    CompressionHeaderBLock chb3 = new CompressionHeaderBLock(bais);
    container3.h = chb3.getCompressionHeader();

    assertNotNull(container3.h);
    System.out.println(container3.h);

    container3.slices = new Slice[container3.landmarks.length];
View Full Code Here

TOP

Related Classes of net.sf.cram.structure.CompressionHeaderBLock

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.