List of usage examples for java.lang Float MAX_VALUE
float MAX_VALUE
To view the source code for java.lang Float MAX_VALUE.
Click Source Link
From source file:MSUmpire.LCMSPeakStructure.LCMSPeakMS1.java
public void RemoveContaminantPeaks(float proportion) { Logger.getRootLogger().info("Removing peak clusters whose m/z appear more than " + proportion * 100 + "% chromatography. No. of peak clusters : " + PeakClusters.size()); float minmz = Float.MAX_VALUE; float maxmz = Float.MIN_VALUE; float minrt = Float.MAX_VALUE; float maxrt = Float.MIN_VALUE; for (PeakCluster peak : PeakClusters) { if (peak.TargetMz() > maxmz) { maxmz = peak.TargetMz();//from w w w. ja v a 2s . c o m } if (peak.TargetMz() < minmz) { minmz = peak.TargetMz(); } if (peak.endRT > maxrt) { maxrt = peak.endRT; } if (peak.startRT < minrt) { minrt = peak.startRT; } } HashMap<Integer, ArrayList<PeakCluster>> map = new HashMap<>(); float[] MzBin = new float[(int) Math.ceil((maxmz - minmz) * 10) + 1]; for (PeakCluster peak : PeakClusters) { int binkey = (int) Math.ceil((peak.TargetMz() - minmz) * 10); MzBin[binkey] += peak.endRT - peak.startRT; if (!map.containsKey(binkey)) { map.put(binkey, new ArrayList<PeakCluster>()); } map.get(binkey).add(peak); } float threshold = proportion * (maxrt - minrt); for (int i = 0; i < MzBin.length; i++) { if (MzBin[i] > threshold) { for (PeakCluster peakCluster : map.get(i)) { PeakClusters.remove(peakCluster); //Logger.getRootLogger().debug("Removing the cluster m/z: "+ peakCluster.TargetMz()+", StartRT: "+ peakCluster.startRT +", EndRT: "+peakCluster.endRT); } } } Logger.getRootLogger().info("Remaining peak clusters : " + PeakClusters.size()); }
From source file:org.broadinstitute.cga.tools.gatk.walkers.cancer.mutect.MuTect.java
@Override public void initialize() { if (MTAC.NOOP) { return;/*w ww. j a v a 2 s.c om*/ } //setting version info // TODO: refactor into getMuTectVersion() final String gatkVersion = CommandLineGATK.getVersionNumber(); ResourceBundle resources = TextFormattingUtils.loadResourceBundle("MuTectText"); final String mutectVersion = resources.containsKey("version") ? resources.getString("version") : "<unknown>"; final String combinedVersion = "MuTect:" + mutectVersion + " Gatk:" + gatkVersion; logger.info("VERSION INFO: " + combinedVersion); refReader = this.getToolkit().getReferenceDataSource().getReference(); callStatsGenerator = new CallStatsGenerator(MTAC.ENABLE_QSCORE_OUTPUT); // check that we have at least one tumor bam for (SAMReaderID id : getToolkit().getReadsDataSource().getReaderIDs()) { if (id.getTags().getPositionalTags().size() == 0) { throw new RuntimeException("BAMs must be tagged as either 'tumor' or 'normal'"); } for (String tag : id.getTags().getPositionalTags()) { if (BAM_TAG_TUMOR.equalsIgnoreCase(tag)) { hasTumorBam = true; tumorSAMReaderIDs.add(id); // fill in the sample name if necessary if (MTAC.TUMOR_SAMPLE_NAME == null) { try { if (getToolkit().getReadsDataSource().getHeader(id).getReadGroups().size() == 0) { throw new RuntimeException( "No Read Groups found for Tumor BAM -- Read Groups are Required, or supply tumor_sample_name!"); } MTAC.TUMOR_SAMPLE_NAME = getToolkit().getReadsDataSource().getHeader(id).getReadGroups() .get(0).getSample(); } catch (NullPointerException npe) { MTAC.TUMOR_SAMPLE_NAME = "tumor"; } } } else if (BAM_TAG_NORMAL.equalsIgnoreCase(tag)) { hasNormalBam = true; normalSAMReaderIDs.add(id); // fill in the sample name if necessary if (MTAC.NORMAL_SAMPLE_NAME == null) { try { if (getToolkit().getReadsDataSource().getHeader(id).getReadGroups().size() == 0) { throw new RuntimeException( "No Read Groups found for Normal BAM -- Read Groups are Required, or supply normal_sample_name!"); } MTAC.NORMAL_SAMPLE_NAME = getToolkit().getReadsDataSource().getHeader(id) .getReadGroups().get(0).getSample(); } catch (NullPointerException npe) { MTAC.NORMAL_SAMPLE_NAME = "normal"; } } } else { throw new RuntimeException("Unknown BAM tag '" + tag + "' must be either 'tumor' or 'normal'"); } } } if (!hasTumorBam) { throw new RuntimeException("At least one BAM tagged as 'tumor' required"); } if (!hasNormalBam) { MTAC.NORMAL_LOD_THRESHOLD = -1 * Float.MAX_VALUE; MTAC.NORMAL_DBSNP_LOD_THRESHOLD = -1 * Float.MAX_VALUE; MTAC.NORMAL_ARTIFACT_LOD_THRESHOLD = Float.MAX_VALUE; MTAC.NORMAL_SAMPLE_NAME = "none"; } this.contaminantAlternateFraction = Math.max(MTAC.MINIMUM_MUTATION_CELL_FRACTION, MTAC.FRACTION_CONTAMINATION); // coverage related initialization double powerConstantEps = Math.pow(10, -1 * (MTAC.POWER_CONSTANT_QSCORE / 10)); this.tumorPowerCalculator = new TumorPowerCalculator(powerConstantEps, MTAC.TUMOR_LOD_THRESHOLD, this.contaminantAlternateFraction); this.normalNovelSitePowerCalculator = new NormalPowerCalculator(powerConstantEps, MTAC.NORMAL_LOD_THRESHOLD); this.normalDbSNPSitePowerCalculator = new NormalPowerCalculator(powerConstantEps, MTAC.NORMAL_DBSNP_LOD_THRESHOLD); this.strandArtifactPowerCalculator = new TumorPowerCalculator(powerConstantEps, MTAC.STRAND_ARTIFACT_LOD_THRESHOLD, 0.0f); stdCovWriter = new CoverageWiggleFileWriter(COVERAGE_FILE); q20CovWriter = new CoverageWiggleFileWriter(COVERAGE_20_Q20_FILE); powerWriter = new CoverageWiggleFileWriter(POWER_FILE); tumorDepthWriter = new CoverageWiggleFileWriter(TUMOR_DEPTH_FILE); normalDepthWriter = new CoverageWiggleFileWriter(NORMAL_DEPTH_FILE); // to force output, all we have to do is lower the initial tumor lod threshold to -infinity if (MTAC.FORCE_OUTPUT) { MTAC.INITIAL_TUMOR_LOD_THRESHOLD = -Float.MAX_VALUE; } // initialize the call-stats file out.println("##" + combinedVersion); out.println(callStatsGenerator.generateHeader()); // initialize the VCF output if (vcf != null) { // TODO: fix for multisample mode Set<String> samples = new HashSet<String>(); samples.add(MTAC.TUMOR_SAMPLE_NAME); samples.add(MTAC.NORMAL_SAMPLE_NAME); Set<VCFHeaderLine> headerInfo = VCFGenerator.getVCFHeaderInfo(); vcf.writeHeader(new VCFHeader(headerInfo, samples)); } lastTime = System.currentTimeMillis(); }
From source file:pipeline.misc_util.Utils.java
public static float getMin(IPluginIOStack source) { if (source == null) { Utils.log("Source stack in null in getStackMax", LogLevel.WARNING); return 0; }/*w w w . ja v a2 s . co m*/ float the_min = Float.MAX_VALUE; for (int i = 0; i < source.getDimensions().depth; i++) { float slice_min = (min(source.getPixels(i))); if (slice_min < the_min) the_min = slice_min; } return the_min; }
From source file:org.ecoinformatics.seek.datasource.darwincore.DarwinCoreDataSource.java
/** * Checks for a valid string for a numerical type, empty is NOT valid if not * valid then return the MAX_VALUE for the number * /* w ww . j a v a 2s . c om*/ * @param aValue * the value to be checked * @param aType * the type of number it is * @return the new value */ private String getValidStringValueForType(String aValue, String aType) { String valueStr = aValue; Integer iVal = (Integer) mType2IntHash.get(aType); switch (iVal.intValue()) { case 0: try { Integer.parseInt(aValue); } catch (Exception e) { valueStr = Integer.toString(Integer.MAX_VALUE); } break; case 1: try { Float.parseFloat(aValue); } catch (Exception e) { valueStr = Float.toString(Float.MAX_VALUE); } break; case 2: try { Double.parseDouble(aValue); } catch (Exception e) { valueStr = Double.toString(Double.MAX_VALUE); } break; case 3: try { Long.parseLong(aValue); } catch (Exception e) { valueStr = Long.toString(Long.MAX_VALUE); } break; case 4: // no-op break; } return valueStr; }
From source file:org.fhcrc.cpl.viewer.ms2.commandline.PostProcessPepXMLCLM.java
public void assignArgumentValues() throws ArgumentValidationException { pepXmlFiles = getUnnamedSeriesFileArgumentValues(); outFile = getFileArgumentValue("out"); outDir = getFileArgumentValue("outdir"); if (pepXmlFiles.length > 1) { assertArgumentAbsent("out", "(unnamed)"); assertArgumentPresent("outdir", "(unnamed)"); }/*from ww w . j av a 2 s . c om*/ if (hasArgumentValue("maxfdr")) assertArgumentAbsent("minpprophet", "maxfdr"); medianCenter = getBooleanArgumentValue("mediancenter"); medianCenterByNumCysteines = getBooleanArgumentValue("bynumcysteines"); medianCenterAllRunsTogether = getBooleanArgumentValue("mediancenterallrunstogether"); medianRatioForCentering = getFloatArgumentValue("medianratioforcenter"); if (hasArgumentValue("medianratioforcenter") && (medianCenterByNumCysteines || medianCenterAllRunsTogether || !medianCenter)) { throw new ArgumentValidationException("medianratioforcenter was provided along with incompatible args"); } requirePepXmlExtension = getBooleanArgumentValue("requirepepxmlextension"); stripQuantMissingLightOrHeavyWithinRun = getBooleanArgumentValue("stripquantmissinglightorheavywithinrun"); stripQuantMissingLightOrHeavyAcrossAll = getBooleanArgumentValue("stripquantmissinglightorheavyacrossruns"); stripQuantNotInHeavyAcrossAll = getBooleanArgumentValue("stripquantmissingheavy"); stripLightIDs = getBooleanArgumentValue("striplightids"); if (stripLightIDs) assertArgumentPresent("label", "striplightids"); stripQuantMatchingRegexp = getBooleanArgumentValue("stripquantmatchingregexp"); if (stripQuantMatchingRegexp) assertArgumentPresent("regexp", "stripquantmatchingregexp"); regexp = getStringArgumentValue("regexp"); int numIncompatibleFlags = 0; if (stripQuantMissingLightOrHeavyWithinRun) numIncompatibleFlags++; if (stripQuantMissingLightOrHeavyAcrossAll) numIncompatibleFlags++; if (stripQuantNotInHeavyAcrossAll) numIncompatibleFlags++; if (numIncompatibleFlags > 1) { throw new ArgumentValidationException("Only one of these flags may be specified: " + "'stripquantmissinglightorheavywithinrun', 'stripquantmissinglightorheavyacrossruns', " + "'stripquantmissingheavy'"); } adjustQuantZeroAreas = getBooleanArgumentValue("adjustquantzeroareas"); stripQuantZeroAreas = getBooleanArgumentValue("stripquantzeroareas"); if (adjustQuantZeroAreas && stripQuantZeroAreas) throw new ArgumentValidationException("Can't both adjust /and/ strip zero areas!"); stripQuantSingleScans = getBooleanArgumentValue("stripquantsinglescan"); filterByProteinPrefix = getBooleanArgumentValue("filterbyproteinprefix"); if (filterByProteinPrefix && !hasArgumentValue("badproteinprefix") && !hasArgumentValue("goodproteinprefix")) { throw new ArgumentValidationException( "If filtering by protein prefix, must specify either a bad or good protein prefix"); } badProteinPrefix = getStringArgumentValue("badproteinprefix"); goodProteinPrefix = getStringArgumentValue("goodproteinprefix"); excludeProteinPrefixQuantOnly = getBooleanArgumentValue("protprefixexcludequantonly"); if (badProteinPrefix != null && goodProteinPrefix != null) throw new ArgumentValidationException("Can't have it both ways (good and bad protein prefixes), sorry"); if (!medianCenter) { assertArgumentAbsent("bynumcysteines", "mediancenter"); assertArgumentAbsent("medianratioforcenter", "mediancenter"); } labelType = ((EnumeratedValuesArgumentDefinition) getArgumentDefinition("label")) .getIndexForArgumentValue(getStringArgumentValue("label")); if (hasArgumentValue("stripproteinfile")) { assertArgumentAbsent("keepproteinfile", "stripproteinfile"); proteinsToStrip = new HashSet<String>(readOneStringPerLine(getFileArgumentValue("stripproteinfile"))); } if (hasArgumentValue("stripproteinquantfile")) { proteinsToStripQuant = new HashSet<String>( readOneStringPerLine(getFileArgumentValue("stripproteinquantfile"))); } if (hasArgumentValue("keepproteinfile")) { assertArgumentAbsent("stripproteinfile", "keepproteinfile"); proteinsToKeep = new HashSet<String>(readOneStringPerLine(getFileArgumentValue("keepproteinfile"))); } if (hasArgumentValue("strippeptidefile")) { Set<String> rawPeptides = new HashSet<String>( readOneStringPerLine(getFileArgumentValue("strippeptidefile"))); peptidesToStrip = new HashSet<String>(); //special processing for peptides. Make sure they're actually peptides for (String peptide : rawPeptides) { boolean ok = true; if (peptide.length() == 0) ok = false; for (int i = 0; i < peptide.length(); i++) { char c = peptide.charAt(i); if ((c >= 'A') && (c <= 'Z')) continue; // uppercase ok = false; } if (!ok) throw new RuntimeException(); peptidesToStrip.add(peptide); } } minRatiosForMedianCenter = getIntegerArgumentValue("minmediancenterratios"); showCharts = getBooleanArgumentValue("showcharts"); minPeptideProphetForMedian = getFloatArgumentValue("minmedianpprophet"); minPeptideProphet = getFloatArgumentValue("minpprophet"); minQuantPeptideProphet = getFloatArgumentValue("minquantpprophet"); maxFDR = getFloatArgumentValue("maxfdr"); minRatio = getFloatArgumentValue("minratio"); maxRatio = getFloatArgumentValue("maxratio"); maxExpect = getFloatArgumentValue("maxexpect"); maxQuantExpect = getFloatArgumentValue("maxquantexpect"); if (hasArgumentValue("maxfracdeltamass")) maxFracDeltaMass = getDeltaMassArgumentValue("maxfracdeltamass"); if (peptidesToStrip == null && proteinsToStrip == null && proteinsToStripQuant == null && proteinsToKeep == null && !medianCenter && !stripQuantMissingLightOrHeavyWithinRun && !stripQuantMissingLightOrHeavyAcrossAll && !filterByProteinPrefix && !stripQuantNotInHeavyAcrossAll && !adjustQuantZeroAreas && !stripQuantZeroAreas && !stripQuantSingleScans && !hasArgumentValue("maxexpect") && minPeptideProphet == 0 && minQuantPeptideProphet == 0 && !stripLightIDs && !stripQuantMatchingRegexp && minRatio == 0 && maxRatio == Float.MAX_VALUE && maxFDR == Float.MAX_VALUE) { throw new ArgumentValidationException("Nothing to do! Quitting"); } }
From source file:org.shaman.terrain.sketch.SketchTerrain_old.java
private int distance(Vector2f p, Vector2f[] curve) { float dist = Float.MAX_VALUE; int index = 0; for (int i = 0; i < curve.length; ++i) { Vector2f c = curve[i];/*from w ww . ja va 2 s.co m*/ float d = p.distanceSquared(c); if (d < dist) { dist = d; index = i; } } return index; }
From source file:org.seedstack.seed.core.internal.application.ConfigurationMembersInjectorTest.java
public org.apache.commons.configuration.Configuration mockConfiguration(Field field, boolean isInconfig) { if (field == null) { return null; }/* ww w . j a v a2 s.co m*/ org.apache.commons.configuration.Configuration configuration = mock( org.apache.commons.configuration.Configuration.class); when(configuration.containsKey(field.getName())).thenReturn(isInconfig); if (isInconfig) { Class<?> type = field.getType(); String configParamName = field.getAnnotation(Configuration.class).value(); if (type.isArray()) { type = type.getComponentType(); if (type == Integer.TYPE || type == Integer.class) { when(configuration.getStringArray(configParamName)) .thenReturn(new String[] { String.valueOf(Integer.MAX_VALUE) }); } else if (type == Boolean.TYPE || type == Boolean.class) { when(configuration.getStringArray(configParamName)).thenReturn(new String[] { "true" }); } else if (type == Short.TYPE || type == Short.class) { when(configuration.getStringArray(configParamName)) .thenReturn(new String[] { String.valueOf(Short.MAX_VALUE) }); } else if (type == Byte.TYPE || type == Byte.class) { when(configuration.getStringArray(configParamName)) .thenReturn(new String[] { String.valueOf(Byte.MAX_VALUE) }); } else if (type == Long.TYPE || type == Long.class) { when(configuration.getStringArray(configParamName)) .thenReturn(new String[] { String.valueOf(Long.MAX_VALUE) }); } else if (type == Float.TYPE || type == Float.class) { when(configuration.getStringArray(configParamName)) .thenReturn(new String[] { String.valueOf(Float.MAX_VALUE) }); } else if (type == Double.TYPE || type == Double.class) { when(configuration.getStringArray(configParamName)) .thenReturn(new String[] { String.valueOf(Double.MAX_VALUE) }); } else if (type == Character.TYPE || type == Character.class) { when(configuration.getStringArray(configParamName)).thenReturn(new String[] { "t" }); } else if (type == String.class) { when(configuration.getStringArray(configParamName)).thenReturn(new String[] { "test" }); } else throw new IllegalArgumentException("Type " + type + " cannot be mocked"); } else { if (type == Integer.TYPE || type == Integer.class) { when(configuration.getString(configParamName)).thenReturn(String.valueOf(Integer.MAX_VALUE)); } else if (type == Boolean.TYPE || type == Boolean.class) { when(configuration.getString(configParamName)).thenReturn("true"); } else if (type == Short.TYPE || type == Short.class) { when(configuration.getString(configParamName)).thenReturn(String.valueOf(Short.MAX_VALUE)); } else if (type == Byte.TYPE || type == Byte.class) { when(configuration.getString(configParamName)).thenReturn(String.valueOf(Byte.MAX_VALUE)); } else if (type == Long.TYPE || type == Long.class) { when(configuration.getString(configParamName)).thenReturn(String.valueOf(Long.MAX_VALUE)); } else if (type == Float.TYPE || type == Float.class) { when(configuration.getString(configParamName)).thenReturn(String.valueOf(Float.MAX_VALUE)); } else if (type == Double.TYPE || type == Double.class) { when(configuration.getString(configParamName)).thenReturn(String.valueOf(Double.MAX_VALUE)); } else if (type == Character.TYPE || type == Character.class) { when(configuration.getString(configParamName)).thenReturn("t"); } else if (type == String.class) { when(configuration.getString(configParamName)).thenReturn("test"); } else throw new IllegalArgumentException("Type " + type + " cannot be mocked"); } } return configuration; }
From source file:lenscorrection.Distortion_Correction.java
protected void extractSIFTPoints(final int index, final List<Feature>[] siftFeatures, final List<List<PointMatch>> inliers, final List<AbstractAffineModel2D<?>> models) { //save all matching candidates final List<List<PointMatch>> candidates = new ArrayList<List<PointMatch>>(); for (int j = 0; j < siftFeatures.length; j++) { if (index == j) continue; candidates.add(FloatArray2DSIFT.createMatches(siftFeatures[index], siftFeatures[j], 1.5f, null, Float.MAX_VALUE, 0.5f)); }/*ww w. jav a2s . co m*/ //get rid of the outliers and save the transformations to match the inliers for (int i = 0; i < candidates.size(); ++i) { final List<PointMatch> tmpInliers = new ArrayList<PointMatch>(); final AbstractAffineModel2D<?> m; switch (sp.expectedModelIndex) { case 0: m = new TranslationModel2D(); break; case 1: m = new RigidModel2D(); break; case 2: m = new SimilarityModel2D(); break; case 3: m = new AffineModel2D(); break; default: return; } try { m.filterRansac(candidates.get(i), tmpInliers, 1000, sp.maxEpsilon, sp.minInlierRatio, 10); } catch (final NotEnoughDataPointsException e) { e.printStackTrace(); } inliers.add(tmpInliers); models.add(m); } }
From source file:pipeline.misc_util.Utils.java
public static float getStackMin(ImagePlus source) { if (source == null) { Utils.log("Source stack in null in getStackMin", LogLevel.INFO); return 0; }//from ww w.j a v a2s.c o m ImageStack stack = source.getStack(); float min = Float.MAX_VALUE; for (int i = 1; i <= stack.getSize(); i++) { float sliceMin = (float) stack.getProcessor(i).getMin(); if (sliceMin < min) min = sliceMin; } return min; }
From source file:org.knime.knip.suise.node.boundarymodel.contourdata.ContourDataMisc.java
private void compareSelection(double[] grid) { PermutohedralLattice lat = new PermutohedralLattice(contourDataGrid().numFeatures(), contourDataGrid().totalLength() + 1, contourDataGrid().totalLength()); double[] value = new double[contourDataGrid().totalLength() + 1]; double[] tmpPos = new double[contourDataGrid().numFeatures()]; int i = 0;// ww w. ja v a2s .c om int numPos = 0; for (int g = 0; g < grid.length; g++) { if (grid[g] == 1) { Arrays.fill(value, 0); value[i] = 1; value[value.length - 1] = 1; double[] vec = contourDataGrid().getVector(g); for (int j = 0; j < vec.length; j++) { tmpPos[j] = vec[j] / m_stdev; } lat.splat(tmpPos, value); i++; numPos++; } } lat.blur(); lat.beginSlice(); Img<FloatType> img = new ArrayImgFactory<FloatType>().create(new int[] { value.length, value.length }, new FloatType()); RandomAccess<FloatType> tmpRA = img.randomAccess(); for (i = 0; i < numPos; i++) { lat.slice(value); tmpRA.setPosition(i, 1); for (int j = 0; j < value.length - 1; j++) { tmpRA.setPosition(j, 0); // double val = value[j] / value[value.length - 1]; double val = value[j]; // value[value.length - 1] += val; tmpRA.get().setReal(val); } value[value.length - 1] = 0; // tmpRA.setPosition(value.length - 1, 0); // tmpRA.get().setReal(value[value.length - 1]); } Pair<FloatType, FloatType> minmax = Operations.compute(new MinMax<FloatType>(), img); Operations.<FloatType, FloatType>map(new Normalize<FloatType>(minmax.getA().getRealDouble(), minmax.getB().getRealDouble(), -Float.MAX_VALUE, Float.MAX_VALUE)).compute(img, img); compareSelection.show(img, 1.0); }