Package org.broad.igv.feature

Examples of org.broad.igv.feature.LocusScore


            String chr = entry.getKey();
            List<LocusScore> scores = entry.getValue();
            int[] positions = new int[scores.size()];
            float[] values = new float[scores.size()];
            for (int i = 0; i < scores.size(); i++) {
                LocusScore s = scores.get(i);
                positions[i] = s.getStart();
                values[i] = s.getScore();
            }
            Map<String, float[]> tmp = new HashMap<String, float[]>(1);
            tmp.put("*", values);
            genomeSummaryData.addData(chr, positions, tmp);
        }
View Full Code Here


        List<LocusScore> ampScores = data.getAmpCounts(chr);
        List<LocusScore> delScores = data.getDelCounts(chr);
        StringBuffer buf = new StringBuffer();
        int startIdx = Math.max(0, FeatureUtils.getIndexBefore(position, ampScores));
        for (int i = startIdx; i < ampScores.size(); i++) {
            LocusScore ampScore = ampScores.get(i);
            if (position >= ampScore.getStart() && position <= ampScore.getEnd()) {
                buf.append("# of samples with log2(cn/2) &gt; &nbsp; " + data.getAmpThreshold() + ": ");
                buf.append(ampScore.getValueString(position, null));
                buf.append("<br># of samples with log2(cn/2) &lt;  " + data.getDelThreshold() + ":  ");
                buf.append(delScores.get(i).getValueString(position, null));
            }
        }
        return buf.length() == 0 ? null : buf.toString();
View Full Code Here

            StringBuffer buf = new StringBuffer();
            buf.append(getName());
            buf.append("<br>");
            if (showPeaks) {
                List<Peak> scores = getFilteredPeaks(chr);
                LocusScore score = getLocusScoreAt(scores, position, frame);
                if (score != null) {
                    foundValue = true;
                    buf.append(score.getValueString(position, getWindowFunction()));
                    if (showSignals) {
                        buf.append("<br>");
                    }
                }
            }

            final WrappedDataSource signalSource = getSignalSource();
            if (showSignals && signalSource != null) {
                List<LocusScore> scores = signalSource.getSummaryScoresForRange(chr, (int) frame.getOrigin(), (int) frame.getEnd(), frame.getZoom());
                LocusScore score = getLocusScoreAt(scores, position, frame);
                if (score != null) {
                    foundValue = true;
                    buf.append("Score = " + score.getScore());
                }
            }
            return foundValue ? buf.toString() : null;
        } catch (IOException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
View Full Code Here

                    break;
                }
            }

            for (int i = interval.startIdx + 1; i < scores.size(); i++) {
                LocusScore locusScore = scores.get(i);
                float value = locusScore.getScore();
                if (Float.isNaN(value)) value = 0;
                interval.dataMax = Math.max(interval.dataMax, value);
                interval.dataMin = Math.min(interval.dataMin, value);
                if (locusScore.getStart() > end) {
                    interval.endIdx = i;
                    break;
                }
            }
        }
View Full Code Here

        double minWidth = 2 * bpPerPixel;    /* * */

        if (scores == null) {
            return "";
        } else {
            LocusScore score = (LocusScore) FeatureUtils.getFeatureAt(position, 0, scores);
            return score == null ? "" : "Mean count: " + score.getScore();
        }
    }
View Full Code Here

     * @param frame
     * @return
     */
    public String getValueStringAt(String chr, double position, int y, ReferenceFrame frame) {
        StringBuffer buf = new StringBuffer();
        LocusScore score = getLocusScoreAt(chr, position, frame);
        // If there is no value here, return null to signal no popup
        if (score == null) {
            return null;
        }
        buf.append(getName() + "<br>");
        if ((getDataRange() != null) && (getRenderer() instanceof XYPlotRenderer)) {
            buf.append("Data scale: " + getDataRange().getMinimum() + " - " + getDataRange().getMaximum() + "<br>");
        }

        buf.append(score.getValueString(position, getWindowFunction()));
        return buf.toString();
    }
View Full Code Here

                    break;
                }
            }

            for (int i = interval.startIdx + 1; i < scores.size(); i++) {
                LocusScore locusScore = scores.get(i);
                float value = locusScore.getScore();
                if (Float.isNaN(value)) value = 0;
                interval.dataMax = Math.max(interval.dataMax, value);
                interval.dataMin = Math.min(interval.dataMin, value);
                if (locusScore.getStart() > end) {
                    interval.endIdx = i;
                    break;
                }
            }
        }
View Full Code Here

        String chr = "chr1";
        int start = 0;
        int end = 1000;

        LocusScore sumScore0 = track0.getSummaryScores(chr, start, end, 0).get(0);
        LocusScore sumScore1 = track1.getSummaryScores(chr, start, end, 0).get(0);
        LocusScore sumScoreComb = combTrack.getSummaryScores(chr, start, end, 0).get(0);

        assertEquals(sumScore0.getStart(), sumScore1.getStart());
        assertEquals(sumScore0.getStart(), sumScoreComb.getStart());
        assertEquals(sumScore1.getEnd(), sumScoreComb.getEnd());

        assertEquals(sumScore0.getScore() - sumScore1.getScore(), sumScoreComb.getScore(), 1e-10);

    }
View Full Code Here

            List<LocusScore> wigScores = wigTrack.getSummaryScores(chr, strt, end, zoom);
            List<LocusScore> bigWigScores = bigWigTrack.getSummaryScores(chr, strt, end, zoom);
            assertEquals(wigScores.size(), bigWigScores.size());
            int ind = 0;
            for (LocusScore ws : wigScores) {
                LocusScore bws = bigWigScores.get(ind);
                assertEquals(ws.getScore(), bws.getScore());
                ind++;
            }
        }

    }
View Full Code Here

            long cMin = genome.getCumulativeOffset(chromo) / 1000 + fudge;
            long cMax = cMin + range;

            for(int ii= 0; ii < wigScores.size(); ii++){
                LocusScore wLocus = wigScores.get(ii);
                if(wLocus.getStart() >= cMin && wLocus.getEnd() <= cMax){
                    float wScore = wigScores.get(ii).getScore();
                    //Just checking our assumption
                    assert wScore > 0;
                }

                LocusScore tLocus = tdfScores.get(ii);
                if(overlaps(cMin, cMax, tLocus)){
                    assertTrue("Found negative value in " + chromo + " at " + tLocus.getStart(), tLocus.getScore() >= 0);
                    posChecked++;
                }
            }

        }
View Full Code Here

TOP

Related Classes of org.broad.igv.feature.LocusScore

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.