Package org.broad.igv.util.collections

Examples of org.broad.igv.util.collections.DoubleArrayList


            for (int i = 0; i < sampleNames.length; i++) {
                SampleData sd = sampleDataMap.get(sampleNames[i]);
                // Check for null?  Should be impossible

                double value;
                DoubleArrayList valueList = sd.getData(type);
                if (valueList == null || valueList.isEmpty()) {
                    value = Double.NaN;
                } else if (valueList.size() == 1) {

                    int cnt = typeCounts.get(type) == null ? 1 : typeCounts.get(type) + 1;
                    typeCounts.put(type, cnt);

                    value = valueList.get(0);
                } else {

                    int cnt = typeCounts.get(type) == null ? valueList.size() : typeCounts.get(type) + valueList.size();
                    typeCounts.put(type, cnt);

                    double[] vs = valueList.toArray();
                    value = StatUtils.mean(vs);
                }
                data[i] = value;

            }
View Full Code Here


        Map<String, String> attributesMap = new HashMap<String, String>();
        int mutationCount;

        public void addDataValue(TrackType type, double value) {

            DoubleArrayList valueArray = valueMap.get(type);
            if (valueArray == null) {
                valueArray = new DoubleArrayList();
                valueMap.put(type, valueArray);
            }
            valueArray.add(value);
        }
View Full Code Here

    public void testParse_underflows() throws Exception {
        GWASParser parser = new GWASParser(new ResourceLocator(TestUtils.DATA_DIR + "gwas/smallp.gwas"), genome);
        GWASData data = parser.parse();
        LinkedHashMap<String, DoubleArrayList> values = data.getValues();
        for (String chr : values.keySet()) {
            DoubleArrayList floats = values.get(chr);
            for (int ff = 0; ff < floats.size(); ff++) {
                double val = floats.get(ff);
                assertFalse("Value is infinite", Double.isInfinite(val));
                assertFalse("Value isNan", Double.isNaN(val));
                assertFalse("Value is 0", val == 0.0f);
            }
        }
View Full Code Here

        }
        this.locations.put(chr, locations);
    }

    public void addValue(String chr, double value) {
        DoubleArrayList valueList = new DoubleArrayList(1);
        if (this.values != null && this.values.get(chr) != null) {
            valueList = this.values.get(chr);
        }
        valueList.add(value);
        this.addValues(chr, valueList);
        if (this.maxValue < value)
            this.maxValue = value;

    }
View Full Code Here

        quantileFunctions = new ArrayList();
        for (WindowFunction wf : windowFunctions) {
            if (PERCENTILE_WINDOW_FUNCTIONS.contains(wf)) {
                quantileFunctions.add(wf);
                if (values == null) {
                    values = new DoubleArrayList();
                }
            }
        }
    }
View Full Code Here

        this.featureType = featureType;
        this.longestFeature = new HashMap();

        // Gather statistics for setting scales.
        boolean isEncodePeak = featureType == EncodePeakFeature.class;
        DoubleArrayList signals = isEncodePeak ? new DoubleArrayList(50000) : null;
        DoubleArrayList qvalues = isEncodePeak ? new DoubleArrayList(50000) : null;
        DoubleArrayList pvalues = isEncodePeak ? new DoubleArrayList(50000) : null;

        for (Map.Entry<String, List<BasicFeature>> entry : featureMap.entrySet()) {
            String chr = entry.getKey();
            List<BasicFeature> features = entry.getValue();
            int longest = 0;
            for (BasicFeature f : features) {

                float s = f.getScore();
                hasScore = hasScore || !Float.isNaN(s);
                if (isEncodePeak) {
                    EncodePeakFeature pf = (EncodePeakFeature) f;
                    signals.add(pf.getSignal());
                    qvalues.add(pf.getQValue());
                    pvalues.add(pf.getPValue());
                }

                final int length = f.getLength();
                if (length > longest) longest = length;


            }
            longestFeature.put(chr, longest);
        }

        scales = new HashMap<SignalField, Range>();
        scales.put(SignalField.Score, new Range(0, 1000));

        double[] s = signals.toArray();
        double sMin = 0;
        double sMax = StatUtils.percentile(s, 90);
        scales.put(SignalField.Signal, new Range(sMin, sMax));

        double[] q = qvalues.toArray();
        scales.put(SignalField.QValue, new Range(0, StatUtils.percentile(q, 90)));

        double[] p = pvalues.toArray();
        scales.put(SignalField.PValue, new Range(0, StatUtils.percentile(p, 90)));

    }
View Full Code Here

                        drawColor = this.primaryColor;

                }

                IntArrayList locations = this.gData.getLocations().get(chr);
                DoubleArrayList values = this.gData.getValues().get(chr);

                int size = locations.size();

                // Loop through data points in a chromosome
                for (int j = 0; j < size; j++) {

                    // Get location, e.g. start for the data point
                    int start;
                    if (chrName.equals("All"))
                        start = genome.getGenomeCoordinate(chr, locations.get(j));
                    else
                        start = locations.get(j);

                    // Based on location, calculate X-coordinate, or break if outside of the view
                    double pX = ((start - origin) / locScale);
                    if ((pX + dx < 0))
                        continue;
                    else if (pX > adjustedRectMaxX)
                        break;

                    // Based on value of the data point, calculate Y-coordinate
                    double dataY = values.get(j);

                    if (!Double.isNaN(dataY)) {

                        int xPointSize = (int) Math.ceil(dataY / pointSizeScale);
View Full Code Here

            this.valueMap = new HashMap<TrackType, DoubleArrayList>();
        }

        void addValue(TrackType tt, double value) {

            DoubleArrayList vlist = valueMap.get(tt);
            if (vlist == null) {
                vlist = new DoubleArrayList();
                valueMap.put(tt, vlist);
            }
            vlist.add(value);
        }
View Full Code Here

            }
            vlist.add(value);
        }

        public double[] getValues(TrackType tt) {
            DoubleArrayList dal = valueMap.get(tt);
            return dal == null ? null : dal.toArray();
        }
View Full Code Here

TOP

Related Classes of org.broad.igv.util.collections.DoubleArrayList

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.