Package com.compomics.util.experiment.identification.matches

Examples of com.compomics.util.experiment.identification.matches.PeptideMatch


        ArrayList<String> notModifiedPeptides = new ArrayList<String>();

        for (String peptideKey : identification.getPeptideIdentification()) {

            PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
            Peptide peptide = peptideMatch.getTheoreticPeptide();

            modified = false;
            accountedModifications = new ArrayList<String>();

            for (ModificationMatch modificationMatch : peptide.getModificationMatches()) {
View Full Code Here


                        if (relatedPeptidesTable.getSelectedRow() >= 0) {
                            relatedPeptidesTable.removeRowSelectionInterval(relatedPeptidesTable.getSelectedRow(), relatedPeptidesTable.getSelectedRow());
                        }
                        row = 0;
                        selectedKey = peptideShakerGUI.getSelectedPsmKey();
                        PeptideMatch peptideMatch = identification.getPeptideMatch(getSelectedPeptide(false));
                        for (String displayedPsm : peptideMatch.getSpectrumMatches()) {
                            if (displayedPsm.equals(selectedKey)) {
                                selectedPsmsTable.setRowSelectionInterval(row, row);
                                selectedPsmsTable.scrollRectToVisible(selectedPsmsTable.getCellRect(row, 0, false));

                                while (relatedPsmsTable.getSelectedRow() >= 0) {
                                    relatedPsmsTable.removeRowSelectionInterval(relatedPsmsTable.getSelectedRow(), relatedPsmsTable.getSelectedRow());
                                }
                                selectedPsmsTableMouseReleased(null);
                                return;
                            }
                            row++;
                        }
                        selectedPsmsTable.setRowSelectionInterval(0, 0);
                        selectedPsmsTable.scrollRectToVisible(selectedPsmsTable.getCellRect(0, 0, false));
                        while (relatedPsmsTable.getSelectedRow() >= 0) {
                            relatedPsmsTable.removeRowSelectionInterval(relatedPsmsTable.getSelectedRow(), selectedPsmsTable.getSelectedRow());
                        }
                        selectedPsmsTableMouseReleased(null);
                        return;
                    }
                    row++;
                }
                row = 0;
                for (String displayedPeptide : relatedPeptides) {
                    if (displayedPeptide.equals(selectedKey)) {
                        relatedPeptidesTable.setRowSelectionInterval(row, row);
                        relatedPeptidesTable.scrollRectToVisible(relatedPeptidesTable.getCellRect(row, 0, false));
                        if (peptidesTable.getSelectedRow() >= 0) {
                            peptidesTable.removeRowSelectionInterval(peptidesTable.getSelectedRow(), peptidesTable.getSelectedRow());
                        }
                        relatedSelected = true;
                        updateSelectedPsmTable(progressDialog, false);
                        updateRelatedPsmTable(progressDialog, true);
                        updateModificationProfiles(progressDialog);
                        updateModificationProfilesTable(progressDialog);
                        row = 0;
                        selectedKey = peptideShakerGUI.getSelectedPsmKey();
                        PeptideMatch peptideMatch = identification.getPeptideMatch(getSelectedPeptide(false));
                        for (String displayedPsm : peptideMatch.getSpectrumMatches()) {
                            if (displayedPsm.equals(selectedKey)) {
                                relatedPsmsTable.setRowSelectionInterval(row, row);
                                relatedPsmsTable.scrollRectToVisible(relatedPsmsTable.getCellRect(row, 0, false));
                                while (selectedPsmsTable.getSelectedRow() >= 0) {
                                    selectedPsmsTable.removeRowSelectionInterval(selectedPsmsTable.getSelectedRow(), selectedPsmsTable.getSelectedRow());
View Full Code Here

                    if (progressDialog.isRunCanceled()) {
                        break;
                    }

                    PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);

                    if (!peptideMatch.getTheoreticPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences())) {

                        probabilities = (PSParameter) identification.getPeptideMatchParameter(peptideKey, probabilities);
                        double p = probabilities.getPeptideProbability();

                        if (!probabilities.isHidden()) {
View Full Code Here

                        probabilities = new PSParameter();
                        probabilities = (PSParameter) identification.getPeptideMatchParameter(displayedPeptides.get(row), probabilities);
                        return probabilities.getProteinInferenceClass();
                    case 3:
                        String peptideKey = displayedPeptides.get(row);
                        PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
                        return peptideShakerGUI.getDisplayFeaturesGenerator().getTaggedPeptideSequence(peptideMatch, true, true, true);
                    case 4:
                        PSPtmScores ptmScores = new PSPtmScores();
                        ptmScores = (PSPtmScores) identification.getPeptideMatch(displayedPeptides.get(row)).getUrParam(ptmScores);
                        if (ptmScores != null && ptmScores.getPtmScoring(getSelectedModification()) != null) {
View Full Code Here

                        probabilities = new PSParameter();
                        probabilities = (PSParameter) identification.getPeptideMatchParameter(relatedPeptides.get(row), probabilities);
                        return probabilities.getProteinInferenceClass();
                    case 3:
                        String peptideKey = relatedPeptides.get(row);
                        PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
                        return peptideShakerGUI.getDisplayFeaturesGenerator().getTaggedPeptideSequence(peptideMatch, true, true, true);
                    case 4:
                        PSPtmScores ptmScores = new PSPtmScores();
                        ptmScores = (PSPtmScores) identification.getPeptideMatch(relatedPeptides.get(row)).getUrParam(ptmScores);
                        if (ptmScores != null && ptmScores.getPtmScoring(getSelectedModification()) != null) {
View Full Code Here

     * @return the keys of the selected PSMs
     */
    private ArrayList<String> getSelectedPsm(boolean relatedPeptide) {
        ArrayList<String> psmKey = new ArrayList<String>();
        try {
            PeptideMatch peptideMatch = identification.getPeptideMatch(getSelectedPeptide(relatedPeptide));
            if (relatedPeptide) {
                int[] selectedRows = relatedPsmsTable.getSelectedRows();
                for (int row : selectedRows) {
                    psmKey.add(peptideMatch.getSpectrumMatches().get(row));
                }
            } else {
                int[] selectedRows = selectedPsmsTable.getSelectedRows();
                for (int row : selectedRows) {
                    psmKey.add(peptideMatch.getSpectrumMatches().get(row));
                }
            }
        } catch (Exception e) {
            peptideShakerGUI.catchException(e);
        }
View Full Code Here

                }
            });

            if (peptidesTable.getSelectedRow() != -1) {
                try {
                    PeptideMatch peptideMatch = identification.getPeptideMatch(displayedPeptides.get((Integer) peptidesTable.getValueAt(peptidesTable.getSelectedRow(), 0) - 1));
                    String sequence = peptideMatch.getTheoreticPeptide().getSequence();

                    ((DefaultTableModel) psmAScoresTable.getModel()).addColumn("");
                    ((DefaultTableModel) psmDeltaScoresTable.getModel()).addColumn("");

                    for (int i = 0; i < sequence.length(); i++) {
                        String columnName = "" + sequence.charAt(i) + (i + 1);
                        ((DefaultTableModel) psmAScoresTable.getModel()).addColumn(columnName);
                        ((DefaultTableModel) psmDeltaScoresTable.getModel()).addColumn(columnName);
                    }

                    String selectedPtmName = getSelectedModification();
                    PTM selectedPtm = ptmFactory.getPTM(selectedPtmName);

                    // add the psm scores (a score and delta score)
                    identification.loadSpectrumMatches(peptideMatch.getSpectrumMatches(), null);
                    for (int i = 0; i < peptideMatch.getSpectrumMatches().size(); i++) {

                        String spectrumKey = peptideMatch.getSpectrumMatches().get(i);
                        PSPtmScores ptmScores = new PSPtmScores();
                        ptmScores = (PSPtmScores) identification.getSpectrumMatch(spectrumKey).getUrParam(ptmScores);
                        ((DefaultTableModel) psmAScoresTable.getModel()).addRow(new Object[]{(i + 1)});
                        ((DefaultTableModel) psmDeltaScoresTable.getModel()).addRow(new Object[]{(i + 1)});
View Full Code Here

                    if (progressDialog.isRunCanceled()) {
                        break;
                    }

                    double value = 0;
                    PeptideMatch peptideMatch = peptideShakerGUI.getIdentification().getPeptideMatch(peptideKey);

                    peptideShakerGUI.getIdentification().loadSpectrumMatchParameters(peptideMatch.getSpectrumMatches(), spectrumParameter, null);
                    for (String spectrumKey : peptideMatch.getSpectrumMatches()) {

                        if (progressDialog.isRunCanceled()) {
                            break;
                        }

                        spectrumParameter = (PSParameter) peptideShakerGUI.getIdentification().getSpectrumMatchParameter(spectrumKey, spectrumParameter);
                        if (spectrumParameter.getMatchValidationLevel().isValidated() && !spectrumParameter.isHidden()) {
                            value = value + 1;
                        }
                    }
                    if (value > maxValue) {
                        maxValue = value;
                    }
                    peptideParameter = (PSParameter) peptideShakerGUI.getIdentification().getPeptideMatchParameter(peptideKey, peptideParameter);

                    if (!peptideParameter.isHidden()) {

                        if (!peptideMatch.getTheoreticPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences())) {
                            if (peptideParameter.getMatchValidationLevel().isValidated()) {
                                if (peptideParameter.getMatchValidationLevel() == MatchValidationLevel.confident) {
                                    validatedValues.add(value);
                                } else {
                                    validatedDoubtfulValues.add(value);
                                }
                            } else {
                                nonValidatedValues.add(value);
                            }
                        } else {
                            if (peptideParameter.getMatchValidationLevel().isValidated()) {
                                validatedDecoyValues.add(value);
                            } else {
                                nonValidatedDecoyValues.add(value);
                            }
                        }
                    }

                    progressDialog.increasePrimaryProgressCounter();
                }
            } else if (peptideMissedCleavagesJRadioButton.isSelected()) {

                // Values for the missed cleavages
                validatedValues = new ArrayList<Double>();
                validatedDoubtfulValues = new ArrayList<Double>();
                nonValidatedValues = new ArrayList<Double>();
                validatedDecoyValues = new ArrayList<Double>();
                nonValidatedDecoyValues = new ArrayList<Double>();
                Enzyme enzyme = peptideShakerGUI.getSearchParameters().getEnzyme();

                for (String peptideKey : peptideShakerGUI.getIdentification().getPeptideIdentification()) {

                    if (progressDialog.isRunCanceled()) {
                        break;
                    }

                    PeptideMatch peptideMatch = peptideShakerGUI.getIdentification().getPeptideMatch(peptideKey);
                    peptideParameter = (PSParameter) peptideShakerGUI.getIdentification().getPeptideMatchParameter(peptideKey, peptideParameter);

                    if (!peptideParameter.isHidden()) {

                        double value = Peptide.getNMissedCleavages(Peptide.getSequence(peptideKey), enzyme);
                        if (value > 0) {
                            if (value > maxValue) {
                                maxValue = value;
                            }
                        }

                        if (!peptideMatch.getTheoreticPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences())) {
                            if (peptideParameter.getMatchValidationLevel().isValidated()) {
                                if (peptideParameter.getMatchValidationLevel() == MatchValidationLevel.confident) {
                                    validatedValues.add(value);
                                } else {
                                    validatedDoubtfulValues.add(value);
                                }
                            } else {
                                nonValidatedValues.add(value);
                            }
                        } else {
                            if (peptideParameter.getMatchValidationLevel().isValidated()) {
                                validatedDecoyValues.add(value);
                            } else {
                                nonValidatedDecoyValues.add(value);
                            }
                        }
                    }

                    progressDialog.increasePrimaryProgressCounter();
                }
            } else if (peptideLengthJRadioButton.isSelected()) {

                // Values for the peptide length
                validatedValues = new ArrayList<Double>();
                validatedDoubtfulValues = new ArrayList<Double>();
                nonValidatedValues = new ArrayList<Double>();
                validatedDecoyValues = new ArrayList<Double>();
                nonValidatedDecoyValues = new ArrayList<Double>();

                for (String peptideKey : peptideShakerGUI.getIdentification().getPeptideIdentification()) {

                    if (progressDialog.isRunCanceled()) {
                        break;
                    }

                    PeptideMatch peptideMatch = peptideShakerGUI.getIdentification().getPeptideMatch(peptideKey);
                    peptideParameter = (PSParameter) peptideShakerGUI.getIdentification().getPeptideMatchParameter(peptideKey, peptideParameter);

                    if (!peptideParameter.isHidden()) {

                        double length = Peptide.getSequence(peptideKey).length();
                        if (length > 0) {
                            if (length > maxValue) {
                                maxValue = length;
                            }
                        }

                        if (!peptideMatch.getTheoreticPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences())) {
                            if (peptideParameter.getMatchValidationLevel().isValidated()) {
                                if (peptideParameter.getMatchValidationLevel() == MatchValidationLevel.confident) {
                                    validatedValues.add(length);
                                } else {
                                    validatedDoubtfulValues.add(length);
View Full Code Here

                        progressDialog.resetPrimaryProgressCounter();
                        progressDialog.setMaxPrimaryProgressCounter(peptideShakerGUI.getIdentification().getPeptideIdentification().size());

                        for (String peptideKey : peptideShakerGUI.getIdentification().getPeptideIdentification()) {

                            PeptideMatch peptideMatch = peptideShakerGUI.getIdentification().getPeptideMatch(peptideKey);
                            PSParameter probabilities = new PSParameter();
                            probabilities = (PSParameter) peptideShakerGUI.getIdentification().getPeptideMatchParameter(peptideKey, probabilities);

                            // write the peptide node
                            if (((String) graphDatabaseFormat.getSelectedItem()).equalsIgnoreCase("Neo4j")) {
                                nodeWriter.write("create n={id:'" + peptideKey + "', name:'" + peptideMatch.getTheoreticPeptide().getTaggedModifiedSequence(peptideShakerGUI.getSearchParameters().getModificationProfile(), false, false, true, false) + "', type:'Peptide'};\n");
                            } else {
                                nodeWriter.write(peptideKey + "\t"
                                        + peptideMatch.getTheoreticPeptide().getTaggedModifiedSequence(peptideShakerGUI.getSearchParameters().getModificationProfile(), false, false, true, false)
                                        + "\tpeptide" + "\t" + probabilities.getMatchValidationLevel() + "\t" + peptideMatch.getTheoreticPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences()) + "\n"); // @TODO: add more information?
                            }

                            // write the peptide to protein edge and the protein nodes
                            for (String protein : peptideMatch.getTheoreticPeptide().getParentProteins(peptideShakerGUI.getSequenceMatchingPreferences())) {

                                // write the protein node
                                if (!proteinsAdded.contains(protein)) {
                                    proteinsAdded.add(protein);
                                    ProteinMatch proteinMatch = peptideShakerGUI.getIdentification().getProteinMatch(protein);
View Full Code Here

        if (keys == null) {
            keys = identification.getPeptideIdentification();
        }

        PSParameter psParameter = new PSParameter();
        PeptideMatch peptideMatch;
        int line = 1;

        if (waitingHandler != null) {
            waitingHandler.setWaitingText("Loading Peptides. Please Wait...");
            waitingHandler.resetSecondaryProgressCounter();
        }
        identification.loadPeptideMatches(keys, waitingHandler);
        if (waitingHandler != null) {
            waitingHandler.setWaitingText("Loading Peptide Details. Please Wait...");
            waitingHandler.resetSecondaryProgressCounter();
        }
        identification.loadPeptideMatchParameters(keys, psParameter, waitingHandler);

        if (waitingHandler != null) {
            waitingHandler.setWaitingText("Exporting. Please Wait...");
            waitingHandler.resetSecondaryProgressCounter();
            waitingHandler.setMaxSecondaryProgressCounter(keys.size());
        }

        for (String peptideKey : keys) {

            if (waitingHandler != null) {
                if (waitingHandler.isRunCanceled()) {
                    return;
                }
                waitingHandler.increaseSecondaryProgressCounter();
            }

            psParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, psParameter);

            if (!validatedOnly || psParameter.getMatchValidationLevel().isValidated()) {

                peptideMatch = identification.getPeptideMatch(peptideKey);

                if (decoys || !peptideMatch.getTheoreticPeptide().isDecoy(sequenceMatchingPreferences)) {

                    boolean first = true;

                    if (indexes) {
                        if (linePrefix != null) {
                            writer.write(linePrefix);
                        }
                        writer.write(line + "");
                        first = false;
                    }

                    for (ExportFeature exportFeature : peptideFeatures) {
                        if (!first) {
                            writer.addSeparator();
                        } else {
                            first = false;
                        }
                        PsPeptideFeature peptideFeature = (PsPeptideFeature) exportFeature;
                        writer.write(getfeature(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, sequenceMatchingPreferences, keys, nSurroundingAA, linePrefix, peptideMatch, psParameter, peptideFeature, validatedOnly, decoys, waitingHandler));
                    }
                    writer.newLine();
                    if (psmSection != null) {
                        String psmSectionPrefix = "";
                        if (linePrefix != null) {
                            psmSectionPrefix += linePrefix;
                        }
                        psmSectionPrefix += line + ".";
                        writer.increaseDepth();
                        psmSection.writeSection(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, sequenceMatchingPreferences, peptideMatch.getSpectrumMatches(), psmSectionPrefix, validatedOnly, decoys, null);
                        writer.decreseDepth();
                    }
                    line++;
                }
            }
View Full Code Here

TOP

Related Classes of com.compomics.util.experiment.identification.matches.PeptideMatch

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.