Package com.compomics.util.preferences

Examples of com.compomics.util.preferences.AnnotationPreferences


                spectrumChartPanel.removeAll();

                String key = getSelectedSpectrumKey();
                MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(key);
                SpectrumPanel tempSpectrumPanel = null;
                AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();

                if (currentSpectrum != null) {
                    Precursor precursor = currentSpectrum.getPrecursor();
                    String charge;
                    if (identification.matchExists(currentSpectrumKey)) {
                        SpectrumMatch spectrumMatch = identification.getSpectrumMatch(currentSpectrumKey);
                        if (spectrumMatch.getBestPeptideAssumption() != null) {
                            charge = spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().toString();
                        } else if (spectrumMatch.getBestTagAssumption() != null) {
                            charge = spectrumMatch.getBestTagAssumption().getIdentificationCharge().toString();
                        } else {
                            throw new IllegalArgumentException("Best hit not found for spectrum " + key + ".");
                        }
                    } else {
                        charge = precursor.getPossibleChargesAsString();
                    }
                    if (currentSpectrum.getMzValuesAsArray().length > 0 && currentSpectrum.getIntensityValuesAsArray().length > 0) {
                        tempSpectrumPanel = new SpectrumPanel(
                                currentSpectrum.getMzValuesAsArray(), currentSpectrum.getIntensityValuesAsArray(),
                                precursor.getMz(), charge,
                                "", 40, false, false, false, 2, false);
                        tempSpectrumPanel.setKnownMassDeltas(peptideShakerGUI.getCurrentMassDeltas());
                        tempSpectrumPanel.setDeltaMassWindow(annotationPreferences.getFragmentIonAccuracy());
                        tempSpectrumPanel.setBorder(null);
                        tempSpectrumPanel.setDataPointAndLineColor(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakColor(), 0);
                        tempSpectrumPanel.setPeakWaterMarkColor(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakColor());
                        tempSpectrumPanel.setPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakWidth());
                        tempSpectrumPanel.setBackgroundPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakWidth());
                    }
                }

                if (identification.matchExists(key)) {

                    SpectrumMatch spectrumMatch = identification.getSpectrumMatch(key);

                    SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
                    int forwardIon = searchParameters.getIonSearched1();
                    int rewindIon = searchParameters.getIonSearched2();
                    ModificationProfile modificationProfile = searchParameters.getModificationProfile();

                    if (currentSpectrum != null && tempSpectrumPanel != null) {

                        if (currentSpectrum.getMzValuesAsArray().length > 0 && currentSpectrum.getIntensityValuesAsArray().length > 0) {

                            if (searchResultsTable.getSelectedRow() != -1) {
                                SpectrumIdentificationAssumption currentAssumption = currentAssumptionsList.get(searchResultsTable.getSelectedRow());

                                if (currentAssumption != null) {
                                    currentSpectrumKey = spectrumMatch.getKey();
                                    if (currentAssumption instanceof PeptideAssumption) {
                                        PeptideAssumption currentPeptideAssumption = (PeptideAssumption) currentAssumption;
                                        Peptide peptide = currentPeptideAssumption.getPeptide();
                                        annotationPreferences.setCurrentSettings(currentPeptideAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumMatch.getKey()),
                                                peptideShakerGUI.getSequenceMatchingPreferences());
                                        ArrayList<IonMatch> annotations = specificAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                                                annotationPreferences.getNeutralLosses(),
                                                annotationPreferences.getValidatedCharges(),
                                                currentPeptideAssumption.getIdentificationCharge().value,
                                                currentSpectrum, peptide,
                                                currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                                                annotationPreferences.getFragmentIonAccuracy(), false, annotationPreferences.isHighResolutionAnnotation());

                                        // add the spectrum annotations
                                        tempSpectrumPanel.setAnnotations(SpectrumAnnotator.getSpectrumAnnotation(annotations));
                                        tempSpectrumPanel.showAnnotatedPeaksOnly(!annotationPreferences.showAllPeaks());
                                        tempSpectrumPanel.setYAxisZoomExcludesBackgroundPeaks(annotationPreferences.yAxisZoomExcludesBackgroundPeaks());

                                        // add de novo sequencing
                                        tempSpectrumPanel.addAutomaticDeNovoSequencing(peptide, annotations,
                                                forwardIon, rewindIon, annotationPreferences.getDeNovoCharge(),
                                                annotationPreferences.showForwardIonDeNovoTags(),
                                                annotationPreferences.showRewindIonDeNovoTags());

                                        peptideShakerGUI.updateAnnotationMenus(currentPeptideAssumption.getIdentificationCharge().value, peptide.getModificationMatches());

                                        // update the spectrum title
                                        String modifiedSequence = peptide.getTaggedModifiedSequence(modificationProfile, false, false, true);
                                        ((TitledBorder) spectrumPanel.getBorder()).setTitle(
                                                PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING
                                                + "Spectrum & Fragment Ions (" + modifiedSequence
                                                + "   " + currentPeptideAssumption.getIdentificationCharge().toString() + "   "
                                                + Util.roundDouble(currentSpectrum.getPrecursor().getMz(), 2) + " m/z)"
                                                + PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING);
                                    } else if (currentAssumption instanceof TagAssumption) {
                                        TagAssumption tagAssumption = (TagAssumption) currentAssumption;

                                        // add the annotations
                                        annotationPreferences.setCurrentSettings(tagAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumMatch.getKey()),
                                                peptideShakerGUI.getSequenceMatchingPreferences());

                                        TagSpectrumAnnotator spectrumAnnotator = new TagSpectrumAnnotator();

                                        ArrayList<IonMatch> annotations = spectrumAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                                                annotationPreferences.getNeutralLosses(),
                                                annotationPreferences.getValidatedCharges(),
                                                tagAssumption.getIdentificationCharge().value,
                                                currentSpectrum, tagAssumption.getTag(),
                                                currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                                                annotationPreferences.getFragmentIonAccuracy(),
                                                false, annotationPreferences.isHighResolutionAnnotation());

                                        // add the spectrum annotations
                                        tempSpectrumPanel.setAnnotations(SpectrumAnnotator.getSpectrumAnnotation(annotations));
                                        tempSpectrumPanel.showAnnotatedPeaksOnly(!annotationPreferences.showAllPeaks());
                                        tempSpectrumPanel.setYAxisZoomExcludesBackgroundPeaks(annotationPreferences.yAxisZoomExcludesBackgroundPeaks());

                                        // add de novo sequencing
                                        tempSpectrumPanel.addAutomaticDeNovoSequencing(tagAssumption.getTag(), annotations,
                                                forwardIon, rewindIon, annotationPreferences.getDeNovoCharge(),
                                                annotationPreferences.showForwardIonDeNovoTags(),
                                                annotationPreferences.showRewindIonDeNovoTags());

                                        // get the modifications for the tag
                                        ArrayList<ModificationMatch> modificationMatches = new ArrayList<ModificationMatch>();

                                        for (TagComponent tagComponent : tagAssumption.getTag().getContent()) {
View Full Code Here


        try {
            spectrumChartJPanel.removeAll();
            spectrumChartJPanel.revalidate();
            spectrumChartJPanel.repaint();

            AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();
            MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(spectrumKey);

            if (currentSpectrum != null && currentSpectrum.getMzValuesAsArray().length > 0) {

                Precursor precursor = currentSpectrum.getPrecursor();
                SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);
                spectrum = new SpectrumPanel(
                        currentSpectrum.getMzValuesAsArray(), currentSpectrum.getIntensityValuesAsArray(),
                        precursor.getMz(), spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().toString(),
                        "", 40, false, false, false, 2, false);
                spectrum.setKnownMassDeltas(peptideShakerGUI.getCurrentMassDeltas());
                spectrum.setDeltaMassWindow(peptideShakerGUI.getAnnotationPreferences().getFragmentIonAccuracy());
                spectrum.setBorder(null);
                spectrum.setDataPointAndLineColor(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakColor(), 0);
                spectrum.setPeakWaterMarkColor(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakColor());
                spectrum.setPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakWidth());
                spectrum.setBackgroundPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakWidth());

                // get the spectrum annotations
                PeptideAssumption peptideAssumption = spectrumMatch.getBestPeptideAssumption();
                Peptide peptide = peptideAssumption.getPeptide();
                int identificationCharge = spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value;
                annotationPreferences.setCurrentSettings(peptideAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumMatch.getKey()), peptideShakerGUI.getSequenceMatchingPreferences());
                ArrayList<IonMatch> annotations = annotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                        annotationPreferences.getNeutralLosses(),
                        annotationPreferences.getValidatedCharges(),
                        identificationCharge,
                        currentSpectrum, peptide,
                        currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                        annotationPreferences.getFragmentIonAccuracy(), false, annotationPreferences.isHighResolutionAnnotation());
                currentSpectrumKey = spectrumMatch.getKey();

                // add the spectrum annotations
                spectrum.setAnnotations(SpectrumAnnotator.getSpectrumAnnotation(annotations));
                spectrum.showAnnotatedPeaksOnly(!annotationPreferences.showAllPeaks());
                spectrum.setYAxisZoomExcludesBackgroundPeaks(annotationPreferences.yAxisZoomExcludesBackgroundPeaks());

                SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
                int forwardIon = searchParameters.getIonSearched1();
                int rewindIon = searchParameters.getIonSearched2();

                // add de novo sequencing
                spectrum.addAutomaticDeNovoSequencing(peptide, annotations,
                        forwardIon, rewindIon, annotationPreferences.getDeNovoCharge(),
                        annotationPreferences.showForwardIonDeNovoTags(),
                        annotationPreferences.showRewindIonDeNovoTags());

                spectrumChartJPanel.add(spectrum);
                peptideShakerGUI.updateAnnotationMenus(identificationCharge, peptide.getModificationMatches());

                ((TitledBorder) spectrumAndFragmentIonPanel.getBorder()).setTitle(
View Full Code Here

        // set the spectrum counting prefrences
        spectrumCountingPreferences = new SpectrumCountingPreferences();

        // set the annotation preferences
        annotationPreferences = new AnnotationPreferences();
        annotationPreferences.setPreferencesFromSearchParameters(searchParameters);
        IonFactory.getInstance().addDefaultNeutralLoss(NeutralLoss.NH3);
        IonFactory.getInstance().addDefaultNeutralLoss(NeutralLoss.H2O);

        // create a shaker which will perform the analysis
View Full Code Here

                            // get the spectrum annotations
                            PeptideAssumption peptideAssumption = spectrumMatch.getBestPeptideAssumption();
                            Peptide currentPeptide = peptideAssumption.getPeptide();
                            PeptideSpectrumAnnotator spectrumAnnotator = peptideShakerGUI.getSpectrumAnnotator();
                            AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();
                            int identificationCharge = spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value;
                            annotationPreferences.setCurrentSettings(peptideAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumKey),
                                    peptideShakerGUI.getSequenceMatchingPreferences());
                            ArrayList<IonMatch> annotations = spectrumAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                                    annotationPreferences.getNeutralLosses(),
                                    annotationPreferences.getValidatedCharges(),
                                    identificationCharge,
                                    currentSpectrum, currentPeptide,
                                    currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                                    annotationPreferences.getFragmentIonAccuracy(), false,
                                    annotationPreferences.isHighResolutionAnnotation());
                            spectrumPanel.setAnnotations(SpectrumAnnotator.getSpectrumAnnotation(annotations));
                            spectrumPanel.rescale(lowerMzZoomRange, upperMzZoomRange);

                            if (!currentSpectrumKey.equalsIgnoreCase(spectrumKey)) {
                                if (annotationPreferences.useAutomaticAnnotation()) {
                                    annotationPreferences.setNeutralLossesSequenceDependant(true);
                                }
                            }

                            peptideShakerGUI.updateAnnotationMenus(identificationCharge, currentPeptide.getModificationMatches());

                            currentSpectrumKey = spectrumKey;

                            // show all or just the annotated peaks
                            spectrumPanel.showAnnotatedPeaksOnly(!annotationPreferences.showAllPeaks());
                            spectrumPanel.setYAxisZoomExcludesBackgroundPeaks(annotationPreferences.yAxisZoomExcludesBackgroundPeaks());

                            int forwardIon = peptideShakerGUI.getSearchParameters().getIonSearched1();
                            int rewindIon = peptideShakerGUI.getSearchParameters().getIonSearched2();

                            // add de novo sequencing
                            spectrumPanel.addAutomaticDeNovoSequencing(currentPeptide, annotations,
                                    forwardIon, rewindIon, annotationPreferences.getDeNovoCharge(),
                                    annotationPreferences.showForwardIonDeNovoTags(),
                                    annotationPreferences.showRewindIonDeNovoTags());

                            // add the spectrum panel to the frame
                            spectrumJPanel.removeAll();
                            spectrumJPanel.add(spectrumPanel);
                            spectrumJPanel.revalidate();
                            spectrumJPanel.repaint();

                            // create and display the fragment ion table
                            ArrayList<ArrayList<IonMatch>> allAnnotations = getAnnotationsForAllSelectedSpectra();

                            if (!peptideShakerGUI.getAnnotationPreferences().useIntensityIonTable()) {
                                fragmentIonsJScrollPane.setViewportView(new FragmentIonTable(currentPeptide, allAnnotations, annotationPreferences.getFragmentIonTypes(),
                                        annotationPreferences.getNeutralLosses(),
                                        annotationPreferences.getValidatedCharges().contains(Integer.valueOf(1)),
                                        annotationPreferences.getValidatedCharges().contains(Integer.valueOf(2))));
                            } else {
                                fragmentIonsJScrollPane.setViewportView(new FragmentIonTable(currentPeptide, allAnnotations, getSelectedSpectra(), annotationPreferences.getFragmentIonTypes(),
                                        annotationPreferences.getNeutralLosses(),
                                        annotationPreferences.getValidatedCharges().contains(Integer.valueOf(1)),
                                        annotationPreferences.getValidatedCharges().contains(Integer.valueOf(2))));
                            }

                            // create the sequence fragment ion view
                            secondarySpectrumPlotsJPanel.removeAll();
                            SequenceFragmentationPanel sequenceFragmentationPanel = new SequenceFragmentationPanel(
                                    peptideShakerGUI.getDisplayFeaturesGenerator().getTaggedPeptideSequence(spectrumMatch, false, false, false),
                                    annotations, true, peptideShakerGUI.getSearchParameters().getModificationProfile(), forwardIon, rewindIon);
                            sequenceFragmentationPanel.setMinimumSize(new Dimension(sequenceFragmentationPanel.getPreferredSize().width, sequenceFragmentationPanel.getHeight()));
                            sequenceFragmentationPanel.setOpaque(true);
                            sequenceFragmentationPanel.setBackground(Color.WHITE);
                            secondarySpectrumPlotsJPanel.add(sequenceFragmentationPanel);

                            // create the intensity histograms
                            secondarySpectrumPlotsJPanel.add(new IntensityHistogram(
                                    annotations, currentSpectrum,
                                    peptideShakerGUI.getAnnotationPreferences().getAnnotationIntensityLimit()));

                            // create the miniature mass error plot
                            MassErrorPlot massErrorPlot = new MassErrorPlot(
                                    annotations, currentSpectrum,
                                    annotationPreferences.getFragmentIonAccuracy(),
                                    peptideShakerGUI.useRelativeError());

                            if (massErrorPlot.getNumberOfDataPointsInPlot() > 0) {
                                secondarySpectrumPlotsJPanel.add(massErrorPlot);
                            }
View Full Code Here

        ArrayList<ArrayList<IonMatch>> allAnnotations = new ArrayList<ArrayList<IonMatch>>();

        int[] selectedRows = psmTable.getSelectedRows();

        PeptideSpectrumAnnotator miniAnnotator = new PeptideSpectrumAnnotator();
        AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();

        try {
            for (int row : selectedRows) {

                SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
                int psmIndex = tableModel.getViewIndex(row);
                String spectrumKey = psmKeys.get(psmIndex);
                MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(spectrumKey);

                if (currentSpectrum != null && peptideTable.getSelectedRow() != -1) {

                    SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);

                    // get the spectrum annotations
                    PeptideAssumption peptideAssumption = spectrumMatch.getBestPeptideAssumption();
                    annotationPreferences.setCurrentSettings(peptideAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumKey), peptideShakerGUI.getSequenceMatchingPreferences());
                    ArrayList<IonMatch> annotations = miniAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                            annotationPreferences.getNeutralLosses(),
                            annotationPreferences.getValidatedCharges(),
                            spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value,
                            currentSpectrum, peptideAssumption.getPeptide(),
                            currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                            annotationPreferences.getFragmentIonAccuracy(), false,
                            annotationPreferences.isHighResolutionAnnotation());
                    allAnnotations.add(annotations);
                    currentSpectrumKey = spectrumKey;
                }
            }
            return allAnnotations;
View Full Code Here

                }

                ArrayList<ArrayList<IonMatch>> allAnnotations = new ArrayList<ArrayList<IonMatch>>();
                ArrayList<MSnSpectrum> allSpectra = new ArrayList<MSnSpectrum>();
                PeptideSpectrumAnnotator miniAnnotator = new PeptideSpectrumAnnotator();
                AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();

                // iterate the selected psms
                for (String spectrumKey : selectedPsmKeys) {

                    MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(spectrumKey);

                    if (currentSpectrum != null) {
                        SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);
                        annotationPreferences.setCurrentSettings(
                                spectrumMatch.getBestPeptideAssumption(),
                                !currentSpectrumKey.equalsIgnoreCase(spectrumKey), peptideShakerGUI.getSequenceMatchingPreferences());
                        ArrayList<IonMatch> annotations = miniAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                                annotationPreferences.getNeutralLosses(),
                                annotationPreferences.getValidatedCharges(),
                                spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value,
                                currentSpectrum,
                                selectedPeptideMatch.getTheoreticPeptide(),
                                currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                                annotationPreferences.getFragmentIonAccuracy(), false,
                                annotationPreferences.isHighResolutionAnnotation());
                        allAnnotations.add(annotations);
                        allSpectra.add(currentSpectrum);

                        currentSpectrumKey = spectrumKey;
                    }
                }

                double bubbleScale = annotationPreferences.getFragmentIonAccuracy() * 10 * peptideShakerGUI.getBubbleScale();

                if (peptideShakerGUI.useRelativeError()) {
                    bubbleScale = annotationPreferences.getFragmentIonAccuracy() * 10000 * peptideShakerGUI.getBubbleScale();
                }

                MassErrorBubblePlot massErrorBubblePlot = new MassErrorBubblePlot(
                        selectedIndexes, allAnnotations, allSpectra, annotationPreferences.getFragmentIonAccuracy(),
                        bubbleScale, selectedIndexes.size() == 1, annotationPreferences.showBars(), peptideShakerGUI.useRelativeError());

                // hide the legend if selecting more than 20 spectra // @TODO: 20 should not be hardcoded here..
                if (selectedIndexes.size() > 20) {
                    massErrorBubblePlot.getChartPanel().getChart().getLegend().setVisible(false);
                }
View Full Code Here

    /**
     * Resets the preferences.
     */
    public void clearPreferences() {
        annotationPreferences = new AnnotationPreferences();
        spectrumCountingPreferences = new SpectrumCountingPreferences();
        ptmScoringPreferences = new PTMScoringPreferences();
        filterPreferences = new FilterPreferences();
        displayPreferences = new DisplayPreferences();
        searchParameters = new SearchParameters();
View Full Code Here

    /**
     * Set the default preferences.
     */
    public void setDefaultPreferences() {
        searchParameters = new SearchParameters();
        annotationPreferences = new AnnotationPreferences();
        annotationPreferences.setAnnotationLevel(0.75);
        annotationPreferences.useAutomaticAnnotation(true);
        spectrumCountingPreferences = new SpectrumCountingPreferences();
        spectrumCountingPreferences.setSelectedMethod(SpectralCountingMethod.NSAF);
        spectrumCountingPreferences.setValidatedHits(true);
View Full Code Here

        // the index column
        columnHeaders.add(" ");
        tempColumnTypes.add(java.lang.Integer.class);
        tooltips.add("a, b and c ion index");

        AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();

        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.A_ION)) {
            columnHeaders.add("a");
            if (areaChart) {
                tempColumnTypes.add(JSparklinesDataset.class);
            } else {
                tempColumnTypes.add(Double.class);
            }
            tooltips.add("a-ion");
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.B_ION)) {
            columnHeaders.add("b");
            if (areaChart) {
                tempColumnTypes.add(JSparklinesDataset.class);
            } else {
                tempColumnTypes.add(Double.class);
            }
            tooltips.add("b-ion");
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.C_ION)) {
            columnHeaders.add("c");
            if (areaChart) {
                tempColumnTypes.add(JSparklinesDataset.class);
            } else {
                tempColumnTypes.add(Double.class);
            }
            tooltips.add("c-ion");
        }

        columnHeaders.add("AA");
        tempColumnTypes.add(java.lang.String.class);
        tooltips.add("amino acid sequence");


        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.X_ION)) {
            columnHeaders.add("x");
            if (areaChart) {
                tempColumnTypes.add(JSparklinesDataset.class);
            } else {
                tempColumnTypes.add(Double.class);
            }
            tooltips.add("x-ion");
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.Y_ION)) {
            columnHeaders.add("y");
            if (areaChart) {
                tempColumnTypes.add(JSparklinesDataset.class);
            } else {
                tempColumnTypes.add(Double.class);
            }
            tooltips.add("y-ion");
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.Z_ION)) {
            columnHeaders.add("z");
            if (areaChart) {
                tempColumnTypes.add(JSparklinesDataset.class);
            } else {
                tempColumnTypes.add(Double.class);
View Full Code Here

    /**
     * Insert area charts into the table.
     */
    private void insertAreaCharts() {

        AnnotationPreferences annotationPreferences = peptideShakerGUI.getAnnotationPreferences();
        PtmtableContent tempContent, tableContent = new PtmtableContent();
        SpectrumFactory spectrumFactory = SpectrumFactory.getInstance();

        for (String spectrumKey : spectrumKeys) {
            try {
                MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumKey);
                SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);
                tempContent = PtmtableContent.getPTMTableContent(peptide, ptm, nPTM, spectrum, annotationPreferences.getIonTypes(),
                        annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value,
                        annotationPreferences.getFragmentIonAccuracy(), spectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()));
                tempContent.normalize();
                tableContent.addAll(tempContent);
            } catch (Exception e) {
                peptideShakerGUI.catchException(e);
            }
        }

        maxAreaChartValue = 0;

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

            int column = 1;
            if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.A_ION)) {
                addAreaChart(tableContent, PeptideFragmentIon.A_ION, aa + 1, column);
                column++;
            }
            if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.B_ION)) {
                addAreaChart(tableContent, PeptideFragmentIon.B_ION, aa + 1, column);
                column++;
            }
            if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.C_ION)) {
                addAreaChart(tableContent, PeptideFragmentIon.C_ION, aa + 1, column);
                column++;
            }

            column++;
            if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.X_ION)) {
                addAreaChart(tableContent, PeptideFragmentIon.X_ION, peptide.getSequence().length() - aa, column);
                column++;
            }
            if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.Y_ION)) {
                addAreaChart(tableContent, PeptideFragmentIon.Y_ION, peptide.getSequence().length() - aa, column);
                column++;
            }
            if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.Z_ION)) {
                addAreaChart(tableContent, PeptideFragmentIon.Z_ION, peptide.getSequence().length() - aa, column);
                column++;
            }
        }

        // set the column renderers

        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.A_ION)) {
            try {
                getColumn("a").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.lineChart, PlotOrientation.VERTICAL, maxAreaChartValue));
            } catch (IllegalArgumentException e) {
                // do nothing
            }
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.B_ION)) {
            try {
                getColumn("b").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.lineChart, PlotOrientation.VERTICAL, maxAreaChartValue));
            } catch (IllegalArgumentException e) {
                // do nothing
            }
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.C_ION)) {
            try {
                getColumn("c").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.lineChart, PlotOrientation.VERTICAL, maxAreaChartValue));
            } catch (IllegalArgumentException e) {
                // do nothing
            }
        }

        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.X_ION)) {
            try {
                getColumn("x").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.lineChart, PlotOrientation.VERTICAL, maxAreaChartValue));
            } catch (IllegalArgumentException e) {
                // do nothing
            }
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.Y_ION)) {
            try {
                getColumn("y").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.lineChart, PlotOrientation.VERTICAL, maxAreaChartValue));
            } catch (IllegalArgumentException e) {
                // do nothing
            }
        }
        if (annotationPreferences.getFragmentIonTypes().contains(PeptideFragmentIon.Z_ION)) {
            try {
                getColumn("z").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.lineChart, PlotOrientation.VERTICAL, maxAreaChartValue));
            } catch (IllegalArgumentException e) {
                // do nothing
            }
View Full Code Here

TOP

Related Classes of com.compomics.util.preferences.AnnotationPreferences

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.