Package com.compomics.util.experiment.biology

Examples of com.compomics.util.experiment.biology.Peptide


                                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)"
View Full Code Here


        String sequence;
        if (currentAssumption instanceof PeptideAssumption) {
            SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
            ModificationProfile modificationProfile = searchParameters.getModificationProfile();
            Peptide peptide = ((PeptideAssumption) currentAssumption).getPeptide();

            boolean showFixed = false; // @TODO: has to be a better way of doing this?
            for (String ptmName : peptideShakerGUI.getDisplayPreferences().getDisplayedPtms()) {
                if (modificationProfile.getFixedModifications().contains(ptmName)) {
                    showFixed = true;
                }
            }

            sequence = peptide.getTaggedModifiedSequence(modificationProfile, true, true, true, !showFixed);
            if (addRowAtBottom) {
                searchResultsTablePeptideTooltips.add(peptideShakerGUI.getDisplayFeaturesGenerator().getPeptideModificationTooltipAsHtml(peptide));
            } else {
                searchResultsTablePeptideTooltips.add(currentRowNumber, peptideShakerGUI.getDisplayFeaturesGenerator().getPeptideModificationTooltipAsHtml(peptide));
            }
View Full Code Here

                && !psmKey.equals(PeptideShakerGUI.NO_SELECTION)) {
            if (peptideShakerGUI.getIdentification().matchExists(psmKey)) {
                try {
                    SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(psmKey);
                    if (spectrumMatch.getBestPeptideAssumption() != null) {
                        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
                        peptideKey = peptide.getMatchingKey(peptideShakerGUI.getSequenceMatchingPreferences());
                    }
                } catch (Exception e) {
                    peptideShakerGUI.catchException(e);
                    return;
                }
View Full Code Here

        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()) {

                String ptmName = modificationMatch.getTheoreticPtm();

                if (!accountedModifications.contains(ptmName)) {
View Full Code Here

            String psmKey = peptideShakerGUI.getSelectedPsmKey();
            if (peptideShakerGUI.getIdentification().matchExists(psmKey)) {
                try {
                    SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(psmKey);
                    if (spectrumMatch.getBestPeptideAssumption() != null) {
                        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
                        selectedKey = peptide.getMatchingKey(peptideShakerGUI.getSequenceMatchingPreferences());
                    }
                } catch (Exception e) {
                    peptideShakerGUI.catchException(e);
                    return;
                }
View Full Code Here

                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(
                        PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING
                        + "Spectrum & Fragment Ions ("
                        + peptideShakerGUI.getDisplayFeaturesGenerator().getTaggedPeptideSequence(spectrumMatch, false, false, true)
View Full Code Here

            case pi:
                return psParameter.getProteinInferenceClassAsString();
            case position:
                accessions = peptideMatch.getTheoreticPeptide().getParentProteins(sequenceMatchingPreferences);
                Collections.sort(accessions);
                Peptide peptide = peptideMatch.getTheoreticPeptide();
                String start = "";
                for (String proteinAccession : accessions) {
                    Protein protein = SequenceFactory.getInstance().getProtein(proteinAccession);
                    ArrayList<Integer> starts = protein.getPeptideStart(peptide.getSequence(),
                            sequenceMatchingPreferences);
                    Collections.sort(starts);
                    boolean first = true;
                    for (int startAa : starts) {
                        if (first) {
                            first = false;
                        } else {
                            start += ", ";
                        }
                        start += startAa;
                    }

                    start += "; ";
                }
                return start;
            case psms:
                return peptideMatch.getSpectrumCount() + "";
            case variable_ptms:
                return getPeptideModificationsAsString(peptideMatch.getTheoreticPeptide(), true);
            case fixed_ptms:
                return getPeptideModificationsAsString(peptideMatch.getTheoreticPeptide(), false);
            case score:
                return -10 * FastMath.log10(psParameter.getPeptideScore()) + "";
            case raw_score:
                return psParameter.getPeptideScore() + "";
            case sequence:
                return peptideMatch.getTheoreticPeptide().getSequence();
            case missed_cleavages:
                String sequence = peptideMatch.getTheoreticPeptide().getSequence();
                return Peptide.getNMissedCleavages(sequence, searchParameters.getEnzyme()) + "";
            case modified_sequence:
                return peptideMatch.getTheoreticPeptide().getTaggedModifiedSequence(searchParameters.getModificationProfile(), false, false, true);
            case starred:
                if (psParameter.isStarred()) {
                    return "1";
                } else {
                    return "0";
                }
            case aaBefore:
                accessions = peptideMatch.getTheoreticPeptide().getParentProteins(sequenceMatchingPreferences);
                Collections.sort(accessions);
                peptide = peptideMatch.getTheoreticPeptide();
                String subSequence = "";
                for (String proteinAccession : accessions) {
                    if (!subSequence.equals("")) {
                        subSequence += "; ";
                    }
                    HashMap<Integer, String[]> surroundingAAs = SequenceFactory.getInstance().getProtein(proteinAccession).getSurroundingAA(peptide.getSequence(),
                            nSurroundingAA, sequenceMatchingPreferences);
                    ArrayList<Integer> starts = new ArrayList<Integer>(surroundingAAs.keySet());
                    Collections.sort(starts);
                    boolean first = true;
                    for (int startAa : starts) {
                        if (first) {
                            first = false;
                        } else {
                            subSequence += ", ";
                        }
                        subSequence += surroundingAAs.get(startAa)[0];
                    }
                }
                return subSequence;
            case aaAfter:
                accessions = peptideMatch.getTheoreticPeptide().getParentProteins(sequenceMatchingPreferences);
                Collections.sort(accessions);
                peptide = peptideMatch.getTheoreticPeptide();
                subSequence = "";
                for (String proteinAccession : accessions) {
                    if (!subSequence.equals("")) {
                        subSequence += "; ";
                    }
                    HashMap<Integer, String[]> surroundingAAs
                            = SequenceFactory.getInstance().getProtein(proteinAccession).getSurroundingAA(peptide.getSequence(),
                                    nSurroundingAA, sequenceMatchingPreferences);
                    ArrayList<Integer> starts = new ArrayList<Integer>(surroundingAAs.keySet());
                    Collections.sort(starts);
                    boolean first = true;
                    for (int startAa : starts) {
View Full Code Here

                        }

                        psmProbabilities = (PSParameter) identification.getSpectrumMatchParameter(spectrumKey, psmProbabilities);
                        SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
                        PeptideAssumption bestAssumption = spectrumMatch.getBestPeptideAssumption();
                        Peptide tempPeptide = bestAssumption.getPeptide();

                        // the peptide
                        br.write(getCurrentTabSpace() + "<PeptideItem>" + System.getProperty("line.separator"));
                        tabCounter++;

                        // peptide sequence
                        br.write(getCurrentTabSpace() + "<Sequence>" + tempPeptide.getSequence() + "</Sequence>" + System.getProperty("line.separator"));

                        // peptide start and end
                        String proteinAccession = proteinMatch.getMainMatch();
                        String proteinSequence = sequenceFactory.getProtein(proteinAccession).getSequence();
                        int peptideStart = proteinSequence.lastIndexOf(tempPeptide.getSequence()) + 1; // @TODO: lastIndexOf should be avoided!!
                        br.write(getCurrentTabSpace() + "<Start>" + peptideStart + "</Start>" + System.getProperty("line.separator"));
                        br.write(getCurrentTabSpace() + "<End>" + (peptideStart + tempPeptide.getSequence().length() - 1) + "</End>" + System.getProperty("line.separator"));

                        // spectrum index reference
                        br.write(getCurrentTabSpace() + "<SpectrumReference>" + spectrumIndexes.get(spectrumMatch.getKey()) + "</SpectrumReference>" + System.getProperty("line.separator"));

                        // modifications
                        writePtms(tempPeptide);

                        // fragment ions
                        writeFragmentIons(spectrumMatch);

                        // Get scores
                        HashMap<Integer, Double> eValues = new HashMap<Integer, Double>();
                        Double mascotScore = null, msAmandaScore = null;
                        for (int se : spectrumMatch.getAdvocates()) {
                            for (double eValue : spectrumMatch.getAllAssumptions(se).keySet()) {
                                for (SpectrumIdentificationAssumption assumption : spectrumMatch.getAllAssumptions(se).get(eValue)) {
                                    if (assumption instanceof PeptideAssumption) {
                                        PeptideAssumption peptideAssumption = (PeptideAssumption) assumption;
                                        if (peptideAssumption.getPeptide().isSameSequenceAndModificationStatus(bestAssumption.getPeptide(), sequenceMatchingPreferences)) {
                                            if (!eValues.containsKey(se) || eValues.get(se) > eValue) {
                                                eValues.put(se, eValue);
                                                if (se == Advocate.mascot.getIndex()) {
                                                    mascotScore = ((MascotScore) assumption.getUrParam(new MascotScore(0))).getScore();
                                                } else if (se == Advocate.msAmanda.getIndex()
                                                        && peptideAssumption.getUrParam(new MsAmandaScore()) != null) {
                                                    msAmandaScore = ((MsAmandaScore) assumption.getUrParam(new MsAmandaScore())).getScore();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        // PTM scores
                        ArrayList<String> modifications = new ArrayList<String>();

                        for (ModificationMatch modificationMatch : bestAssumption.getPeptide().getModificationMatches()) {
                            if (modificationMatch.isVariable()) {
                                if (!modifications.contains(modificationMatch.getTheoreticPtm())) {
                                    modifications.add(modificationMatch.getTheoreticPtm());
                                }
                            }
                        }

                        StringBuilder dScore = new StringBuilder();
                        Collections.sort(modifications);
                        PSPtmScores ptmScores = new PSPtmScores();

                        for (String mod : modifications) {

                            if (spectrumMatch.getUrParam(ptmScores) != null) {

                                if (dScore.length() > 0) {
                                    dScore.append(", ");
                                }

                                ptmScores = (PSPtmScores) spectrumMatch.getUrParam(new PSPtmScores());
                                dScore.append(mod).append(" (");

                                if (ptmScores != null && ptmScores.getPtmScoring(mod) != null) {
                                    PtmScoring ptmScoring = ptmScores.getPtmScoring(mod);
                                    boolean firstSite = true;
                                    ArrayList<Integer> sites = new ArrayList<Integer>(ptmScoring.getDSites());
                                    Collections.sort(sites);
                                    for (int site : sites) {
                                        if (firstSite) {
                                            firstSite = false;
                                        } else {
                                            dScore.append(", ");
                                        }
                                        dScore.append(site).append(": ").append(ptmScoring.getDeltaScore(site));
                                    }
                                } else {
                                    dScore.append("Not Scored");
                                }
                                dScore.append(")");
                            }
                        }

                        StringBuilder probabilisticScore = new StringBuilder();

                        if (ptmScoringPreferences.isProbabilitsticScoreCalculation()) {

                            for (String mod : modifications) {

                                if (spectrumMatch.getUrParam(ptmScores) != null) {

                                    if (probabilisticScore.length() > 0) {
                                        probabilisticScore.append(", ");
                                    }

                                    ptmScores = (PSPtmScores) spectrumMatch.getUrParam(new PSPtmScores());
                                    probabilisticScore.append(mod).append(" (");

                                    if (ptmScores != null && ptmScores.getPtmScoring(mod) != null) {
                                        PtmScoring ptmScoring = ptmScores.getPtmScoring(mod);
                                        boolean firstSite = true;
                                        ArrayList<Integer> sites = new ArrayList<Integer>(ptmScoring.getProbabilisticSites());
                                        Collections.sort(sites);
                                        for (int site : sites) {
                                            if (firstSite) {
                                                firstSite = false;
                                            } else {
                                                probabilisticScore.append(", ");
                                            }
                                            probabilisticScore.append(site).append(": ").append(ptmScoring.getProbabilisticScore(site));
                                        }
                                    } else {
                                        probabilisticScore.append("Not Scored");
                                    }

                                    probabilisticScore.append(")");
                                }
                            }
                        }

                        // @TODO: the line below uses the protein tree, which has to be rebuilt if not available...
                        ArrayList<String> peptideParentProteins = tempPeptide.getParentProteins(sequenceMatchingPreferences);
                        String peptideProteins = "";
                        for (String accession : peptideParentProteins) {
                            if (!peptideProteins.equals("")) {
                                peptideProteins += ", ";
                            }
View Full Code Here

                                PSParameter psParameter = new PSParameter();
                                MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumKey);

                                for (int scoreIndex : processingPreferences.getScores(advocateIndex)) {

                                    Peptide peptide = peptideAssumption.getPeptide();
                                    boolean decoy = peptide.isDecoy(sequenceMatchingPreferences);
                                    double score;

                                    if (scoreIndex == PsmScores.native_score.index) {
                                        score = peptideAssumption.getScore();
                                    } else {
View Full Code Here

                                }

                                assumption.setScore(score);

                                PeptideAssumption peptideAssumption = (PeptideAssumption) assumption;
                                Peptide peptide = peptideAssumption.getPeptide();
                                boolean decoy = peptide.isDecoy(sequenceMatchingPreferences);
                                inputMap.addEntry(advocateIndex, spectrumFileName, score, decoy);

//                                if (decoy) {
//                                    br.write(Spectrum.getSpectrumTitle(spectrumKey) + "\t" + peptide.getKey() + "\t" + score + "\t" + 1);
//                                } else {
View Full Code Here

TOP

Related Classes of com.compomics.util.experiment.biology.Peptide

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.