Package org.bioinfo.ngs.qc.qualimap.gui.utils

Examples of org.bioinfo.ngs.qc.qualimap.gui.utils.StatsKeeper$Section


    IndexChunker.Chunk chunk = index.next();
    assert chunk.getNelems() == section.computeSize()/2;
  }

  public void testChunkerTiled() throws InvalidRangeException {
    Section dataSection = new Section("0:0, 20:39,  0:1353 ");
    Section wantSection = new Section("0:2, 22:3152,0:1350");
    IndexChunkerTiled index = new IndexChunkerTiled(dataSection, wantSection);
    while(index.hasNext()) {
      Layout.Chunk chunk = index.next();
      System.out.println(" "+chunk);
    }
View Full Code Here


      System.out.println(" "+chunk);
    }
  }

  public void testChunkerTiled2() throws InvalidRangeException {
    Section dataSection = new Section("0:0, 40:59,  0:1353  ");
    Section wantSection = new Section("0:2, 22:3152,0:1350");
    IndexChunkerTiled index = new IndexChunkerTiled(dataSection, wantSection);
    while(index.hasNext()) {
      Layout.Chunk chunk = index.next();
      System.out.println(" "+chunk);
    }
View Full Code Here

    int[] dataShape = A.getShape();
    assert dataShape.length == shape.length;
    for (int i = 0; i < shape.length; i++)
      assert dataShape[i] == shape[i];
    Section all = v.getShapeAsSection();
    System.out.println("  Entire dataset="+all);

    for (int k = 0; k < ntrials; k++) {
      // create a random subset, read and compare
      testOne(v, randomSubset(all, 1), A);
View Full Code Here

      CompareNetcdf.compareData(sdata, Asection);
  }

  private static Section randomSubset(Section all, int stride) throws InvalidRangeException {
    Section s = new Section();
    for (Range r : all.getRanges()) {
      int first = random(r.first(), r.last() / 2);
      int last = random(r.last() / 2, r.last());
      s.appendRange(first, last, stride);
    }
    return s;
  }
View Full Code Here

   
    if (v.getDataType() == DataType.SEQUENCE)
      indexSelect = null; // ignore whatever was sent

    // get the selected Ranges, or all, and add to the list
    Section section;
    if (indexSelect != null) {
      section = new Section(indexSelect);
      section = Section.fill(section, v.getShape()); // Check section has no nulls, set from shape array.
    } else {
      section = v.getShapeAsSection(); // all
    }
View Full Code Here

    System.out.println(" dump of ctv = \n" + lev);

    VariableDS v = (VariableDS) ncd.findVariable(varName);
    assert v != null;
    System.out.printf(" data variable = %s%n", v);
    Section varSection = new Section(v.getShapeAsSection());

    List cList = v.getCoordinateSystems();
    assert cList != null;
    assert cList.size() == 1;
    CoordinateSystem csys = (CoordinateSystem) cList.get(0);

    List<CoordinateTransform> vList = new ArrayList<CoordinateTransform>();
    for (CoordinateTransform ct : csys.getCoordinateTransforms()) {
      if (ct.getTransformType() == TransformType.Vertical)
        vList.add(ct);
    }
    assert vList.size() == 1;
    CoordinateTransform ct = (CoordinateTransform) vList.get(0);
    assert ct.getTransformType() == TransformType.Vertical;
    assert ct instanceof VerticalCT;

    VerticalCT vct = (VerticalCT) ct;
    assert vct.getVerticalTransformType() == vtype : vct.getVerticalTransformType();

    VariableDS ctv = CoordTransBuilder.makeDummyTransformVariable(ncd, ct);
    System.out.println(" dump of equivilent ctv = \n" + ctv);

    VerticalTransform vt = null;
    if (timeName == null) {
      vt = vct.makeVerticalTransform(ncd, null);
      assert !vt.isTimeDependent();
      ucar.ma2.Array coordVals = vt.getCoordinateArray(0);
      assert (null != coordVals);

      Section cSection = new Section(coordVals.getShape());
      System.out.printf(" coordVal shape = %s %n", cSection);
      assert varSection.computeSize() == cSection.computeSize();

    } else {
      Dimension timeDim = ncd.findDimension(timeName);
      assert null != timeDim;
      vt = vct.makeVerticalTransform(ncd, timeDim);
      assert vt.isTimeDependent();

      varSection = varSection.removeRange(0); // remove time dependence for comparision

      for (int i = 0; i < timeDim.getLength(); i++) {
        ucar.ma2.ArrayDouble.D3 coordVals = vt.getCoordinateArray(i);
        assert (null != coordVals);
        Section cSection = new Section(coordVals.getShape());
        System.out.printf("%s: varSection shape = %s %n", v.getFullName(), varSection);
        System.out.printf("%s: coordVal shape = %s %n", v.getFullName(), cSection);
        assert varSection.computeSize() == cSection.computeSize();
      }
    }
    assert vt != null;
    assert vclass.isInstance(vt);
View Full Code Here

    GridDataset ds = null;
    try {
      ds = GridDataset.open(uri);
      GeoGrid grid = ds.findGridByName(var);
      Section s = new Section(grid.getShape());
      System.out.printf("var = %s %n", s);

      GridCoordSystem GridCoordS = grid.getCoordinateSystem();
      VerticalTransform vt = GridCoordS.getVerticalTransform();
      ArrayDouble.D3 z = vt.getCoordinateArray(0);
      Section sv = new Section(z.getShape());
      System.out.printf("3dcoord = %s %n", sv);

      if (vt.isTimeDependent())
        s = s.removeRange(0);
      assert s.equals(sv);
View Full Code Here

        /*
         * create the section of multidimensional array indices
         * that defines the exact data that need to be read
         * for this image index and parameters
         */
        final Section section = new Section(ranges);
   
        /*
         * Setting SampleModel and ColorModel.
         */
        final SampleModel sampleModel = wrapper.getSampleModel().createCompatibleSampleModel(destWidth, destHeight);
        final ColorModel colorModel = ImageIOUtilities.createColorModel(sampleModel);
   
        final WritableRaster raster = Raster.createWritableRaster(sampleModel, new Point(0, 0));
        final BufferedImage image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null);

        CoordinateAxis axis = wrapper.variableDS.getCoordinateSystems().get(0).getLatAxis();
        boolean flipYAxis = false;
        try {
            Array yAxisStart = axis.read(new Section().appendRange(2));
            float y1 = yAxisStart.getFloat(0);
            float y2 = yAxisStart.getFloat(1);
            if (y2 > y1) {
                flipYAxis=true;
            }
View Full Code Here

                ranges.add(new Range(first, first + length - 1, stride));
            } catch (InvalidRangeException e) {
                // TODO LOGME
            }
        }
        final Section sections = new Section(ranges);

        /*
         * Setting SampleModel and ColorModel.
         */
        final SampleModel sampleModel = wrapper.getSampleModel().createCompatibleSampleModel(destWidth, destHeight);
View Full Code Here

TOP

Related Classes of org.bioinfo.ngs.qc.qualimap.gui.utils.StatsKeeper$Section

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.