Package org.broad.igv.feature

Examples of org.broad.igv.feature.LocusScore


                    public int compare(LocusScore o1, LocusScore o2) {
                        return o1.getStart() - o2.getStart();
                    }
                });
        while(dualIter.hasNext()){
            LocusScore score = dualIter.next();
            boundariesSet.add(score.getStart());
            boundariesSet.add(score.getEnd());
        }
        Integer[] boundariesArray = boundariesSet.toArray(new Integer[0]);
        Arrays.sort(boundariesArray);

        int outerScoreInd = 0;
        int innerScoreInd = 0;
        //Calculate value for each interval
        for(int bb=0; bb < boundariesArray.length-1; bb++){
            int start = boundariesArray[bb];
            int end = boundariesArray[bb+1];
            //It shouldn't be possible for more than one LocusScore of either
            //tracks to overlap each interval, since the start/ends
            //were based on all start/ends of the inputs
            outerScoreInd = findContains(start, end, outerScores, Math.max(outerScoreInd, 0));
            innerScoreInd = findContains(start, end, innerScores, Math.max(innerScoreInd, 0));
            LocusScore outerScore = getContains(outerScores, outerScoreInd);
            LocusScore innerScore = getContains(innerScores, innerScoreInd);

            if(outerScore == null && innerScore == null) continue;
            float score = combineScores(outerScore,  innerScore);
            BasicScore newScore = new BasicScore(start, end, score);
            combinedScoresList.add(newScore);
View Full Code Here


     * @param scoresList
     * @param startIndex Optimization, where to start searching in {@code scoresList}
     **/
    private int findContains(int start, int end, List<LocusScore> scoresList, int startIndex) {
        for(int ii=startIndex; ii < scoresList.size(); ii++){
            LocusScore score = scoresList.get(ii);
            if(score.getStart() <= start && score.getEnd() >= end){
                return ii;
            }else if(score.getStart() >= end){
                return -1;
            }
        }
        return -1;
    }
View Full Code Here

            int minWidth = (int) (2 * bpPerPixel);    /* * */

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

        // give a 2 pixel window, otherwise very narrow features will be missed.
        double bpPerPixel = frame.getScale();
        double minWidth = 2 * bpPerPixel;    /*
                                              */

        LocusScore amp = null;
        List<GisticScore> ampScores = ampScoreMap.get(chr);
        if (ampScores != null) {
            amp = (LocusScore) FeatureUtils.getFeatureAt(position, 0, ampScores);
        }

        LocusScore del = null;
        List<GisticScore> delScores = delScoreMap.get(chr);
        if (delScores != null) {
            del = (LocusScore) FeatureUtils.getFeatureAt(position, 0, delScores);
        }

        if ((amp == null) && (del == null)) {
            return "";
        } else {
            StringBuffer buf = new StringBuffer();
            if (amp != null) {
                buf.append("Amplification score: " + amp.getScore());
            }
            if (del != null) {
                buf.append("<br>Deletion score: " + del.getScore());
            }
            return buf.toString();

        }
    }
View Full Code Here

        return tile;
    }

    private LocusScore getCompositeScore(Accumulator accumulator, int accumulatedStart, int accumulatedEnd) {
        LocusScore ls;
        if (accumulator.getNpts() == 1) {
            ls = new NamedScore(accumulatedStart, accumulatedEnd, accumulator.getRepData()[0], accumulator.getRepProbes()[0]);
        } else {
            float value = accumulator.getValue();
            ls = new CompositeScore(accumulatedStart, accumulatedEnd, value, accumulator.getRepData(),
View Full Code Here

            List<LocusScore> nonOverlappingFeatures = new LinkedList();
            List<LocusScore> overlappingFeatures = new LinkedList();

            // Prime the loop with the first feature, it can't overlap itself
            LocusScore f1 = workingList.remove(0);
            nonOverlappingFeatures.add(f1);
            while (workingList.size() > 0) {
                LocusScore f2 = workingList.remove(0);
                int scaledStart = (int) (f2.getStart() / scale);
                int scaledEnd = (int) (f1.getEnd() / scale);
                if (scaledStart > scaledEnd) {
                    nonOverlappingFeatures.add(f2);
                    f1 = f2;
                } else {
View Full Code Here

    public static void sortFeatureList(List<? extends LocusScore> features) {

        Collections.sort(features, new Comparator() {

            public int compare(Object o1, Object o2) {
                LocusScore f1 = (LocusScore) o1;
                LocusScore f2 = (LocusScore) o2;
                return (int) (f1.getStart() - f2.getStart());
            }
        });
    }
View Full Code Here

        int endIdx = features.size();

        while (startIdx != endIdx) {
            int idx = (startIdx + endIdx) / 2;

            LocusScore feature = features.get(idx);

            // Correct for zero vs 1 based coordinates.
            // TODO -- document this.
            double effectiveStart = feature.getStart() + 1;
            if (position >= effectiveStart) {

                double effectiveWidth = Math.max(minWidth, feature.getEnd() - feature.getStart());

                if (position <= effectiveStart + effectiveWidth) {
                    return features.get(idx);
                } else {
                    if (idx == startIdx) {
View Full Code Here

    protected static int[] findBoundaries(List<LocusScore> scores) {
        // Create list of all boundaries
        int[] boundaries = new int[2 * scores.size() + 1];
        for (int i = 0; i < scores.size(); i++) {
            LocusScore score = scores.get(i);
            boundaries[2 * i] = score.getStart();
            boundaries[2 * i + 1] = score.getEnd();
        }
        Arrays.sort(boundaries);
        // Remove duplicates
        IntArrayList boundaryList = new IntArrayList(boundaries.length);
        int lastPos = -1;
View Full Code Here

        }

        try {
            Iterator<LocusScore> iter = pluginFeatureSource.getFeatures(chr, adjustedStart, adjustedEnd, -1);
            List<LocusScore> list = new ArrayList<LocusScore>(1000);
            LocusScore score;
            dataMin = Double.MAX_VALUE;
            dataMax = -Double.MAX_VALUE;

            while (iter.hasNext()) {
                score = iter.next();
                dataMin = Math.min(dataMin, score.getScore());
                dataMax = Math.max(dataMax, score.getScore());
                list.add(score);
                longestFeature = Math.max(longestFeature, score.getEnd() - score.getStart());
            }
            longestFeatureMap.put(chr, longestFeature);

            int length = list.size();
            int[] startLocations = new int[length];
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.