Examples of Peptide


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

     * @throws MzMLUnmarshallerException exception thrown whenever a problem
     * occurred while reading the mzML file
     */
    private void writeFragmentIons(SpectrumMatch spectrumMatch) throws IOException, MzMLUnmarshallerException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException, SQLException {

        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
        annotationPreferences.setCurrentSettings(spectrumMatch.getBestPeptideAssumption(), true, sequenceMatchingPreferences);
        MSnSpectrum tempSpectrum = ((MSnSpectrum) spectrumFactory.getSpectrum(spectrumMatch.getKey()));

        ArrayList<IonMatch> annotations = spectrumAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                annotationPreferences.getNeutralLosses(),
View Full Code Here

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

                && !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

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

                            spectrumPanel.setPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakWidth());
                            spectrumPanel.setBackgroundPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakWidth());

                            // 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());
View Full Code Here

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

                && !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

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

                    pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                    PeptideSpecificMap peptideMap = pSMaps.getPeptideSpecificMap();
                    ProteinMap proteinMap = pSMaps.getProteinMap();
                    SpectrumMatch spectrumMatch = identification.getSpectrumMatch(matchKey);
                    if (spectrumMatch.getBestPeptideAssumption() != null) {
                        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
                        String peptideKey = peptide.getMatchingKey(sequenceMatchingPreferences);
                        identificationFeaturesGenerator.updateNConfidentSpectraForPeptide(peptideKey);
                        PSParameter peptidePSParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, psParameter);

                        if (peptidePSParameter.getMatchValidationLevel().isValidated()) {
View Full Code Here

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

                spectrum = SpectrumFactory.getInstance().getSpectrum(spectrumKey);
                return spectrum.getMaxIntensity() + "";
            case intensity_coverage:
                spectrum = SpectrumFactory.getInstance().getSpectrum(spectrumKey);
                double coveredIntensity = 0;
                Peptide peptide = peptideAssumption.getPeptide();
                ArrayList<IonMatch> matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) spectrum, peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                for (IonMatch ionMatch : matches) {
                    coveredIntensity += ionMatch.peak.intensity;
                }
                double coverage = 100 * coveredIntensity / spectrum.getTotalIntensity();
                return coverage + "";
            case mz_error:
                precursor = SpectrumFactory.getInstance().getPrecursor(spectrumKey);
                return peptideAssumption.getDeltaMass(precursor.getMz(), true) + "";
            case rt:
                precursor = SpectrumFactory.getInstance().getPrecursor(spectrumKey);
                return precursor.getRt() + "";
            case algorithm_score:
                int id = peptideAssumption.getAdvocate();
                double score = peptideAssumption.getScore();
                return Advocate.getAdvocate(id).getName() + " (" + score + ")";
            case sequence:
                return peptideAssumption.getPeptide().getSequence();
            case missed_cleavages:
                String sequence = peptideAssumption.getPeptide().getSequence();
                return Peptide.getNMissedCleavages(sequence, searchParameters.getEnzyme()) + "";
            case modified_sequence:
                return peptideAssumption.getPeptide().getTaggedModifiedSequence(searchParameters.getModificationProfile(), false, false, true) + "";
            case spectrum_charge:
                precursor = SpectrumFactory.getInstance().getPrecursor(spectrumKey);
                return precursor.getPossibleChargesAsString() + "";
            case spectrum_file:
                String spectrumFile = Spectrum.getSpectrumFile(spectrumKey);
                return spectrumFile;
            case spectrum_scan_number:
                return SpectrumFactory.getInstance().getSpectrum(spectrumKey).getScanNumber();
            case spectrum_title:
                return Spectrum.getSpectrumTitle(spectrumKey);
            case starred:
                if (psParameter.isStarred()) {
                    return "1";
                } else {
                    return "0";
                }
            case theoretical_mass:
                return peptideAssumption.getPeptide().getMass() + "";
            case validated:
                return psParameter.getMatchValidationLevel().toString();
            case fragment_mz_accuracy_score:
                score = PsmScores.getDecreasingScore(peptideAssumption.getPeptide(),
                        (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey),
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value, searchParameters, PsmScores.aa_ms2_mz_fidelity.index);
                return score + "";
            case intensity_score:
                score = PsmScores.getDecreasingScore(peptideAssumption.getPeptide(),
                        (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey),
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value, searchParameters, PsmScores.aa_intensity.index);
                return score + "";
            case sequence_coverage:
                peptide = peptideAssumption.getPeptide();
                spectrum = SpectrumFactory.getInstance().getSpectrum(spectrumKey);
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) spectrum, peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                int sequenceLength = peptide.getSequence().length();
                boolean[] aaCoverage = new boolean[sequenceLength];
                for (IonMatch ionMatch : matches) {
                    Ion ion = ionMatch.ion;
                    if (ion instanceof PeptideFragmentIon) {
                        PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                        int number = peptideFragmentIon.getNumber();
                        aaCoverage[number - 1] = true;
                    }
                }
                double nIons = 0.0;
                for (boolean aa : aaCoverage) {
                    if (aa) {
                        nIons += 1;
                    }
                }
                coverage = 100 * nIons / sequenceLength;
                return coverage + "";
            case longest_amino_acid_sequence_annotated:
                peptide = peptideAssumption.getPeptide();
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey), peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                sequence = peptide.getSequence();
                sequenceLength = sequence.length();
                boolean[] coverageForward = new boolean[sequenceLength];
                boolean[] coverageRewind = new boolean[sequenceLength];
                for (IonMatch ionMatch : matches) {
                    Ion ion = ionMatch.ion;
                    if (ion instanceof PeptideFragmentIon) {
                        PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                        int number = peptideFragmentIon.getNumber();
                        if (peptideFragmentIon.getSubType() == PeptideFragmentIon.A_ION
                                || peptideFragmentIon.getSubType() == PeptideFragmentIon.B_ION
                                || peptideFragmentIon.getSubType() == PeptideFragmentIon.C_ION) {
                            coverageForward[number - 1] = true;
                        } else {
                            coverageRewind[number - 1] = true;
                        }
                    }
                }
                aaCoverage = new boolean[sequenceLength];
                boolean previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = coverageForward[aaIndex];
                    if (current && previous) {
                        aaCoverage[aaIndex] = true;
                    }
                    previous = current;
                }
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = coverageRewind[aaIndex];
                    if (current && previous) {
                        aaCoverage[sequenceLength - aaIndex - 1] = true;
                    }
                    previous = current;
                }
                StringBuilder currentTag = new StringBuilder();
                String longestTag = new String();
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    if (aaCoverage[aaIndex]) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.toString();
                }
                return longestTag;
            case longest_amino_acid_sequence_annotated_single_serie:
                peptide = peptideAssumption.getPeptide();
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey), peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                sequence = peptide.getSequence();
                sequenceLength = sequence.length();
                HashMap<Integer, boolean[]> ionCoverage = new HashMap<Integer, boolean[]>(6);
                ionCoverage.put(PeptideFragmentIon.A_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.B_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.C_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.X_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.Y_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.Z_ION, new boolean[sequenceLength]);
                for (IonMatch ionMatch : matches) {
                    if (ionMatch.charge.value == 1) {
                        Ion ion = ionMatch.ion;
                        if (ion instanceof PeptideFragmentIon) {
                            PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                            int number = peptideFragmentIon.getNumber();
                            if (peptideFragmentIon.getSubType() == PeptideFragmentIon.A_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.A_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.B_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.B_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.C_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.C_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.X_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.X_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.Y_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.Y_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.Z_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.Z_ION)[number - 1] = true;
                            }
                        }
                    }
                }
                longestTag = new String();
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.A_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.B_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.C_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.X_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(sequenceLength - aaIndex - 1));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.reverse().toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.Y_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(sequenceLength - aaIndex - 1));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.reverse().toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.Z_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(sequenceLength - aaIndex - 1));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.reverse().toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }

                return longestTag;
            case amino_acids_annotated:
                peptide = peptideAssumption.getPeptide();
                spectrum = SpectrumFactory.getInstance().getSpectrum(spectrumKey);
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) spectrum, peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                sequence = peptide.getSequence();
                sequenceLength = sequence.length();
                coverageForward = new boolean[sequenceLength];
                coverageRewind = new boolean[sequenceLength];
                for (IonMatch ionMatch : matches) {
                    Ion ion = ionMatch.ion;
View Full Code Here

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

        this.ptm = ptm;
        double ptmMass = ptm.getMass();

        try {
            peptideMatch = peptideShakerGUI.getIdentification().getPeptideMatch(peptideKey);
            Peptide peptide = peptideMatch.getTheoreticPeptide();
            peptidePtmScore = (PSPtmScores) peptideMatch.getUrParam(new PSPtmScores());
            if (peptidePtmScore != null) {

                mainSelection = new boolean[peptide.getSequence().length()];
                for (String ptmName : peptidePtmScore.getConfidentlyLocalizedPtms()) {
                    PTM tempPTM = ptmFactory.getPTM(ptmName);
                    if (tempPTM.getMass() == ptmMass) {
                        for (int site : peptidePtmScore.getConfidentSitesForPtm(ptmName)) {
                            mainSelection[site] = true;
                        }
                    }
                }

                secondarySelection = new boolean[peptide.getSequence().length()];
                for (String ptmName : peptidePtmScore.getAmbiguouslyLocalizedPtms()) {
                    PTM tempPTM = ptmFactory.getPTM(ptmName);
                    if (tempPTM.getMass() == ptmMass) {
                        for (int site : peptidePtmScore.getAmbiguousModificationsSites(ptmName).keySet()) {
                            secondarySelection[site] = true;
View Full Code Here

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

     */
    private void updateSequenceLabel() {
        try {
            DisplayPreferences displayPreferences = peptideShakerGUI.getDisplayPreferences();
            ModificationProfile modificationProfile = peptideShakerGUI.getSearchParameters().getModificationProfile();
            Peptide peptide = peptideMatch.getTheoreticPeptide();
            PSPtmScores ptmScores = new PSPtmScores();
            ptmScores = (PSPtmScores) peptideMatch.getUrParam(ptmScores);
            HashMap<Integer, ArrayList<String>> fixedModifications = DisplayFeaturesGenerator.getFilteredModifications(peptide.getIndexedFixedModifications(), displayPreferences.getDisplayedPtms());
            HashMap<Integer, ArrayList<String>> confidentLocations = DisplayFeaturesGenerator.getFilteredConfidentModificationsSites(ptmScores, displayPreferences.getDisplayedPtms());
            HashMap<Integer, ArrayList<String>> representativeAmbiguousLocations = DisplayFeaturesGenerator.getFilteredAmbiguousModificationsRepresentativeSites(ptmScores, displayPreferences.getDisplayedPtms());
            HashMap<Integer, ArrayList<String>> secondaryAmbiguousLocations = DisplayFeaturesGenerator.getFilteredAmbiguousModificationsRepresentativeSites(ptmScores, displayPreferences.getDisplayedPtms());

            String modName = ptm.getName();
View Full Code Here

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

            case non_validated_peptides:
            case validated_psms_peptides:
                if (identification.matchExists(spectrumKey)) {
                    SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
                    if (spectrumMatch.getBestPeptideAssumption() != null) {
                        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
                        boolean decoy = false;
                        for (String accession : peptide.getParentProteins(sequenceMatchingPreferences)) {
                            if (sequenceFactory.isDecoyAccession(accession)) {
                                decoy = true;
                                break;
                            }
                        }
                        if (!decoy) {
                            String peptideKey = peptide.getMatchingKey(sequenceMatchingPreferences);
                            psParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, psParameter);
                            if (exportType == ExportType.non_validated_peptides || ((PSParameter) identification.getSpectrumMatchParameter(spectrumKey, psParameter)).getMatchValidationLevel().isValidated()) {
                                if (psParameter.getMatchValidationLevel().isValidated()) {
                                    return exportType == ExportType.validated_psms_peptides;
                                }
                            }
                        }
                    }
                    return exportType == ExportType.non_validated_peptides;
                } else {
                    return false;
                }
            case non_validated_proteins:
            case validated_psms_peptides_proteins:
                if (identification.matchExists(spectrumKey)) {
                    SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
                    if (spectrumMatch.getBestPeptideAssumption() != null) {
                        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
                        boolean decoy = false;
                        for (String accession : peptide.getParentProteins(sequenceMatchingPreferences)) {
                            if (sequenceFactory.isDecoyAccession(accession)) {
                                decoy = true;
                                break;
                            }
                        }
                        if (!decoy) {
                            String peptideKey = peptide.getMatchingKey(sequenceMatchingPreferences);
                            if (exportType == ExportType.non_validated_proteins
                                    || ((PSParameter) identification.getPeptideMatchParameter(peptideKey, psParameter)).getMatchValidationLevel().isValidated()
                                    && ((PSParameter) identification.getSpectrumMatchParameter(spectrumKey, psParameter)).getMatchValidationLevel().isValidated()) {
                                ArrayList<String> proteins = peptide.getParentProteins(sequenceMatchingPreferences);
                                for (String accession : proteins) {
                                    ArrayList<String> accessions = identification.getProteinMap().get(accession);
                                    if (accessions != null) {
                                        for (String proteinKey : accessions) {
                                            psParameter = (PSParameter) identification.getProteinMatchParameter(proteinKey, psParameter);
View Full Code Here

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

     * @param peptideKey
     */
    private void insertPeptideData(String peptideKey) throws Exception {

        PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
        Peptide peptide = peptideMatch.getTheoreticPeptide();
        ArrayList<String> proteinAccessions = peptide.getParentProteins(sequenceMatchingPreferences);
        StringBuilder proteinAccessionsAsString = new StringBuilder();
        for (String proteinAccession : proteinAccessions) {
            if (proteinAccessionsAsString.length() > 0) {
                proteinAccessionsAsString.append(';');
            }
            proteinAccessionsAsString.append(proteinAccession);
        }
        ArrayList<String> proteinGroups = identification.getProteinMatches(peptide);

        PSParameter psParameter = new PSParameter();

        ArrayList<String> spectrumKeys = peptideMatch.getSpectrumMatches();

        identification.loadSpectrumMatches(spectrumKeys, null);
        identification.loadSpectrumMatchParameters(spectrumKeys, psParameter, null);

        for (String spectrumKey : spectrumKeys) {

            psParameter = (PSParameter) identification.getSpectrumMatchParameter(spectrumKey, psParameter);
            SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);

            if (spectrumMatch.getBestPeptideAssumption() != null) { // Should always be the case

                PeptideAssumption peptideAssumption = spectrumMatch.getBestPeptideAssumption();
                peptide = peptideAssumption.getPeptide();

                int column = 1;
                HSSFRow rowHead = sheet.createRow(++currentRow);
                rowHead.setHeightInPoints(12.75f);

                Cell cell = rowHead.createCell(column++);
                MatchValidationLevel matchValidationLevel = psParameter.getMatchValidationLevel();
                // High, Medium or Low - refers to the confidence in the peptide
                if (matchValidationLevel == MatchValidationLevel.confident) {
                    cell.setCellValue("High");
                } else if (matchValidationLevel == MatchValidationLevel.doubtful) {
                    cell.setCellValue("Medium");
                } else {
                    cell.setCellValue("Low");
                }
                cell.setCellStyle(a2CellStyle);

                cell = rowHead.createCell(column++);
                cell.setCellValue(peptide.getSequenceWithLowerCasePtms()); // peptide sequence, modified residues in lower case
                cell.setCellStyle(peptideRowCellStyle);

                cell = rowHead.createCell(column++);
                cell.setCellValue(1); // number of PSMs
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(proteinAccessions.size()); // number of proteins
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(proteinGroups.size()); // number of protein groups
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(proteinAccessionsAsString.toString()); // protein accessions, separated by semi colon
                cell.setCellStyle(peptideRowCellStyle);

                cell = rowHead.createCell(column++);
                cell.setCellValue(getPeptideModificationsAsString(peptide)); // the modifications, separated by semi colon _and_ space // @TODO: reformat
                cell.setCellStyle(peptideRowCellStyle);

                cell = rowHead.createCell(column++);
                Double delta = psParameter.getDeltaPEP(); // PeptideShaker closest equivalent to a delta Cn
                if (delta == null) {
                    cell.setCellValue(Double.NaN);
                    // @TODO: set another type?
                } else {
                    cell.setCellValue(delta);
                    cell.setCellType(Cell.CELL_TYPE_NUMERIC);
                }
                cell.setCellStyle(peptideRowCellStyle);

                cell = rowHead.createCell(column++);
                cell.setCellValue(0); // PeptideShaker q-value // @TODO: insert real value
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(psParameter.getPsmProbability()); // pep value
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                double score = psParameter.getPsmScore(); // PeptideShaker closest equivalent to an ion score
                cell.setCellValue(score);
                cell.setCellStyle(peptideRowCellStyle);
                if (score != Double.POSITIVE_INFINITY) {
                    cell.setCellType(Cell.CELL_TYPE_NUMERIC);
                }

                cell = rowHead.createCell(column++);
                cell.setCellValue(psParameter.getPsmProbabilityScore()); // PeptideShaker closest equivalent to an e-value
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(peptideAssumption.getIdentificationCharge().value); // charge
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(identification.getPeptideMatch(peptideKey).getTheoreticPeptide().getMass()
                        + ElementaryIon.proton.getTheoreticMass()); // theoretical mass for single charge: MH+ [Da]
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                Precursor precursor = spectrumFactory.getPrecursor(spectrumKey);

                cell = rowHead.createCell(column++);
                cell.setCellValue(peptideAssumption.getDeltaMass(precursor.getMz(), true)); // mass error in ppm
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                Double rt = precursor.getRt();
                if (rt > 0) {
                    rt /= 60;
                } else {
                    rt = Double.NaN;
                }
                cell.setCellValue(rt); // retention time in minutes
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);

                cell = rowHead.createCell(column++);
                cell.setCellValue(peptide.getNMissedCleavages(enzyme)); // number of missed cleavages
                cell.setCellStyle(peptideRowCellStyle);
                cell.setCellType(Cell.CELL_TYPE_NUMERIC);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.