Package no.uib.jsparklines.data

Examples of no.uib.jsparklines.data.JSparklinesDataSeries


                                        dataAll.add(percentAll);
                                        ArrayList<Double> dataDataset = new ArrayList<Double>();
                                        dataDataset.add(percentDataset);

                                        // create a JSparklineDataSeries 
                                        JSparklinesDataSeries sparklineDataseriesAll = new JSparklinesDataSeries(dataAll, Color.RED, "All");
                                        JSparklinesDataSeries sparklineDataseriesDataset = new JSparklinesDataSeries(dataDataset, peptideShakerGUI.getSparklineColor(), "Dataset");

                                        // add the data series to JSparklineDataset
                                        ArrayList<JSparklinesDataSeries> sparkLineDataSeries = new ArrayList<JSparklinesDataSeries>();
                                        sparkLineDataSeries.add(sparklineDataseriesAll);
                                        sparkLineDataSeries.add(sparklineDataseriesDataset);
View Full Code Here


                            }

                            ArrayList<Double> data = new ArrayList<Double>();
                            data.add(new Double(sequenceCounter));

                            JSparklinesDataSeries sparklineDataseries;

                            if (covered) {
                                sparklineDataseries = new JSparklinesDataSeries(data, peptideShakerGUI.getSparklineColor(), null);
                            } else {
                                sparklineDataseries = new JSparklinesDataSeries(data, new Color(0, 0, 0, 0), null);
                            }

                            sparkLineDataSeriesCoverage.add(sparklineDataseries);
                        }
View Full Code Here

                HashMap<Integer, ArrayList<ResidueAnnotation>> proteinTooltips = new HashMap<Integer, ArrayList<ResidueAnnotation>>();

                // we need to add a first empty filler as the coverage table starts at 0
                ArrayList<Double> data = new ArrayList<Double>();
                data.add(new Double(1));
                JSparklinesDataSeries sparklineDataseriesPtm = new JSparklinesDataSeries(data, new Color(0, 0, 0, 0), null);
                sparkLineDataSeriesPtm.add(sparklineDataseriesPtm);

                PSPtmScores psPtmScores = new PSPtmScores();
                ProteinMatch proteinMatch = peptideShakerGUI.getIdentification().getProteinMatch(proteinKey);

                String sequence = sequenceFactory.getProtein(proteinMatch.getMainMatch()).getSequence();
                psPtmScores = (PSPtmScores) proteinMatch.getUrParam(psPtmScores);
                int unmodifiedCounter = 0;

                // get the fixed ptms
                HashMap<Integer, String> fixedPtms = new HashMap<Integer, String>(); // @TODO: note this this only supports one fixed ptm per residue

                Identification identification = peptideShakerGUI.getIdentification();
                identification.loadPeptideMatches(peptideKeys, null);
                DisplayPreferences displayPreferences = peptideShakerGUI.getDisplayPreferences();

                for (String peptideKey : peptideKeys) {
                    boolean modified = false;
                    for (String ptmName : displayPreferences.getDisplayedPtms()) {
                        if (Peptide.isModified(peptideKey, ptmName)) {
                            modified = true;
                            break;
                        }
                    }
                    if (modified) {
                        PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
                        for (ModificationMatch modMatch : peptideMatch.getTheoreticPeptide().getModificationMatches()) {
                            if (!modMatch.isVariable()) {
                                String ptmName = modMatch.getTheoreticPtm();
                                if (displayPreferences.isDisplayedPTM(ptmName)) {
                                    ArrayList<Integer> indexes = sequenceFactory.getProtein(proteinAccession).getPeptideStart(Peptide.getSequence(peptideKey),
                                            peptideShakerGUI.getSequenceMatchingPreferences());
                                    for (Integer index : indexes) {
                                        fixedPtms.put(modMatch.getModificationSite() + index - 2, ptmName);
                                    }
                                }
                            }
                        }
                    }
                }

                for (int aa = 0; aa < sequence.length(); aa++) {

                    String ptmName = fixedPtms.get(aa);
                    for (String variablePTM : psPtmScores.getPtmsAtRepresentativeSite(aa)) {
                        if (displayPreferences.isDisplayedPTM(variablePTM)) {
                            ptmName = variablePTM;
                            break;
                        }
                    }
                    for (String variablePTM : psPtmScores.getConfidentModificationsAt(aa)) {
                        if (displayPreferences.isDisplayedPTM(variablePTM)) {
                            ptmName = variablePTM;
                            break;
                        }
                    }

                    if (ptmName != null) {

                        // add the non-modified area
                        if (unmodifiedCounter > 0) {
                            data = new ArrayList<Double>(1);
                            data.add(new Double(unmodifiedCounter));
                            sparklineDataseriesPtm = new JSparklinesDataSeries(data, new Color(0, 0, 0, 0), null);
                            sparkLineDataSeriesPtm.add(sparklineDataseriesPtm);
                        }

                        // @TODO: what about multiple ptms on the same residue..?
//                        if (psPtmScores.getMainModificationsAt(aa).size() > 1) {
//                            for (int i=0; i<psPtmScores.getMainModificationsAt(aa).size(); i++) {
//                                psPtmScores.getMainModificationsAt(aa).get(i);
//                            }
//                        }
                        // @TODO: are peptide terminal mods excluded?? 
                        Color ptmColor = peptideShakerGUI.getSearchParameters().getModificationProfile().getColor(ptmName);
                        if (ptmColor == null) {
                            ptmColor = Color.lightGray;
                        }

                        ArrayList<ResidueAnnotation> annotations = new ArrayList<ResidueAnnotation>(1);
                        annotations.add(new ResidueAnnotation(ptmName, null, false));
                        proteinTooltips.put(sparkLineDataSeriesPtm.size(), annotations);

                        data = new ArrayList<Double>(1);
                        data.add(new Double(1));
                        sparklineDataseriesPtm = new JSparklinesDataSeries(data, ptmColor, null);
                        sparkLineDataSeriesPtm.add(sparklineDataseriesPtm);

                        // reset the non-modified area counter
                        unmodifiedCounter = 0;

                    } else {
                        unmodifiedCounter++;
                    }
                }

                if (unmodifiedCounter > 0) {
                    // add the remaining non-modified area
                    data = new ArrayList<Double>();
                    data.add(new Double(unmodifiedCounter));
                    sparklineDataseriesPtm = new JSparklinesDataSeries(data, new Color(0, 0, 0, 0), null);
                    sparkLineDataSeriesPtm.add(sparklineDataseriesPtm);
                }

                ptmChart = new ProteinSequencePanel(Color.WHITE).getSequencePlot(this, new JSparklinesDataset(sparkLineDataSeriesPtm), proteinTooltips, false, false);
                sequencePtmsPanel.removeAll();
View Full Code Here

            Color areaColor = SpectrumPanel.determineFragmentIonColor(genericIon, false);
            areaColor = new Color((int) (colorCoef * areaColor.getRed()), (int) (colorCoef * areaColor.getGreen()), (int) (colorCoef * areaColor.getBlue()));
            String tooltip = "<html>" + PeptideFragmentIon.getSubTypeAsString(fragmentIonType) + "<sub>" + aa + "</sub>" + modification + "</html>";

            // create a JSparklineDataSeries 
            JSparklinesDataSeries sparklineDataseries = new JSparklinesDataSeries(data, areaColor, tooltip);

            // add the data series to JSparklineDataset
            sparkLineDataSeriesAll.add(sparklineDataseries);
        }
        JSparklinesDataset dataset = new JSparklinesDataset(sparkLineDataSeriesAll);
View Full Code Here

        CategoryToolTipGenerator myTooltips = new ProteinAnnotations(proteinAnnotations);

        // add the data
        for (int i = 0; i < sparklineDataset.getData().size(); i++) {

            JSparklinesDataSeries sparklineDataSeries = sparklineDataset.getData().get(i);

            for (int j = 0; j < sparklineDataSeries.getData().size(); j++) {
                barChartDataset.addValue(sparklineDataSeries.getData().get(j), "" + i, "" + j);
                renderer.setSeriesPaint(i, sparklineDataSeries.getSeriesColor());
                renderer.setSeriesToolTipGenerator(i, myTooltips);
            }
        }

        // create the chart
View Full Code Here

                Color color = colors.get(previousColorIndex);
                if (color == null) {
                    throw new IllegalArgumentException("Color not set for index " + previousColorIndex + ".");
                }
                // @TODO: take height into account
                sparkLineDataSeriesCoverage.add(new JSparklinesDataSeries(series, color, null));
                previousColorIndex = newColorIndex;
                previousIndex = i;
                previousHeight = newHeight;
            }
        }
        double length = aaHeight.length - previousIndex;
        ArrayList<Double> series = new ArrayList<Double>(1);
        series.add(length);
        Color color = colors.get(previousColorIndex);
        if (color == null) {
            throw new IllegalArgumentException("Color not set for index " + previousColorIndex + ".");
        }
        // @TODO: take height into account
        sparkLineDataSeriesCoverage.add(new JSparklinesDataSeries(series, color, null));
        return sparkLineDataSeriesCoverage;
    }
View Full Code Here

TOP

Related Classes of no.uib.jsparklines.data.JSparklinesDataSeries

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.