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

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


     * @throws ClassNotFoundException
     */
    public String getAmbiguousPtmSiteNumber(String proteinKey)
            throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException {

        ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
        PSPtmScores psPtmScores = new PSPtmScores();
        psPtmScores = (PSPtmScores) proteinMatch.getUrParam(psPtmScores);
        StringBuilder result = new StringBuilder();
        ArrayList<String> ptms = psPtmScores.getAmbiguouslyLocalizedPtms();
        Collections.sort(ptms);

        for (String ptmName : ptms) {
View Full Code Here


     * @throws ClassNotFoundException
     */
    public String getAmbiguousPtmSiteNumber(String proteinKey, ArrayList<String> targetedPtms)
            throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException {

        ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
        PSPtmScores psPtmScores = new PSPtmScores();
        psPtmScores = (PSPtmScores) proteinMatch.getUrParam(psPtmScores);
        ArrayList<Integer> sites = new ArrayList<Integer>();

        for (String ptmName : targetedPtms) {
            HashMap<Integer, ArrayList<Integer>> ptmAmbiguousSites = psPtmScores.getAmbiguousModificationsSites(ptmName);
            for (int site : ptmAmbiguousSites.keySet()) {
View Full Code Here

     * @throws SQLException
     * @throws ClassNotFoundException
     */
    public String getModifiedSequence(String proteinKey) throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException {

        ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
        String sequence = sequenceFactory.getProtein(proteinMatch.getMainMatch()).getSequence();
        PSPtmScores psPtmScores = new PSPtmScores();
        psPtmScores = (PSPtmScores) proteinMatch.getUrParam(psPtmScores);
        StringBuilder result = new StringBuilder();

        for (int aa = 0; aa < sequence.length(); aa++) {
            result.append(sequence.charAt(aa));
            if (!psPtmScores.getConfidentModificationsAt(aa).isEmpty()) {
View Full Code Here

            for (String proteinKey : identification.getProteinIdentification()) {

                if (!ProteinMatch.isDecoy(proteinKey)) {
                    probabilities = (PSParameter) identification.getProteinMatchParameter(proteinKey, probabilities);
                    if (!probabilities.isHidden()) {
                        ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
                        double score = probabilities.getProteinProbabilityScore();
                        int nPeptides = -proteinMatch.getPeptideMatchesKeys().size();
                        int nSpectra = -getNSpectra(proteinKey);

                        if (needMaxValues) {

                            if (-nPeptides > maxPeptides) {
                                maxPeptides = -nPeptides;
                            }

                            if (-nSpectra > maxSpectra) {
                                maxSpectra = -nSpectra;
                            }

                            double tempSpectrumCounting = estimateSpectrumCounting(proteinKey);

                            if (tempSpectrumCounting > maxSpectrumCounting) {
                                maxSpectrumCounting = tempSpectrumCounting;
                            }

                            Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());

                            if (currentProtein != null) {
                                double mw = sequenceFactory.computeMolecularWeight(proteinMatch.getMainMatch());
                                if (mw > maxMW) {
                                    maxMW = mw;
                                }
                            }
View Full Code Here

     * @throws InterruptedException
     */
    public ArrayList<String> getSortedPeptideKeys(String proteinKey) throws SQLException, IOException, ClassNotFoundException, InterruptedException {
        if (!proteinKey.equals(identificationFeaturesCache.getCurrentProteinKey()) || identificationFeaturesCache.getPeptideList() == null) {

            ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
            HashMap<Double, HashMap<Integer, ArrayList<String>>> peptideMap = new HashMap<Double, HashMap<Integer, ArrayList<String>>>();
            PSParameter probabilities = new PSParameter();
            int maxSpectrumCount = 0;

            identification.loadPeptideMatches(proteinMatch.getPeptideMatchesKeys(), null);
            identification.loadPeptideMatchParameters(proteinMatch.getPeptideMatchesKeys(), probabilities, null);
            for (String peptideKey : proteinMatch.getPeptideMatchesKeys()) {

                probabilities = (PSParameter) identification.getPeptideMatchParameter(peptideKey, probabilities); // @TODO: replace by batch selection?

                if (!probabilities.isHidden()) {
                    double peptideProbabilityScore = probabilities.getPeptideProbabilityScore();
View Full Code Here

     */
    private String getItemDescription(String key, Type itemType) throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException {
        Identification identification = peptideShakerGUI.getIdentification();
        switch (itemType) {
            case PROTEIN:
                ProteinMatch proteinMatch = identification.getProteinMatch(key);
                String mainMatch = proteinMatch.getMainMatch();
                String description = sequenceFactory.getHeader(mainMatch).getSimpleProteinDescription();
                String result = mainMatch;
                for (String accession : ProteinMatch.getAccessions(key)) {
                    if (!accession.equals(mainMatch)) {
                        if (!result.equals(mainMatch)) {
View Full Code Here

            PSMaps psMaps = new PSMaps();
            psMaps = (PSMaps) getIdentification().getUrParam(psMaps);
            PsmPTMMap psmPTMMap = psMaps.getPsmPTMMap();
            PtmScorer ptmScorer = new PtmScorer(psmPTMMap);
            Identification identification = getIdentification();
            ProteinMatch proteinMatch = identification.getProteinMatch(selectedProteinKey);
            ptmScorer.scorePTMs(identification, proteinMatch, getSearchParameters(), getAnnotationPreferences(), false, getPtmScoringPreferences(), getSequenceMatchingPreferences());
        } catch (Exception e) {
            catchException(e);
        }
View Full Code Here

        }

        String peptideKey = PeptideShakerGUI.NO_SELECTION;

        try {
            ProteinMatch proteinMatch = getIdentification().getProteinMatch(proteinKey);
            ArrayList<String> peptideKeys;

            try {
                peptideKeys = getIdentificationFeaturesGenerator().getSortedPeptideKeys(proteinKey);
            } catch (Exception e) {
                try {
                    // try without order
                    peptideKeys = proteinMatch.getPeptideMatchesKeys();
                } catch (Exception e1) {
                    e1.printStackTrace();
                    peptideKeys = new ArrayList<String>();
                }
            }
View Full Code Here

        try {
            if (column == 0) {
                return row + 1;
            } else if (column == 1) {
                ProteinMatch proteinMatch = identification.getProteinMatch(proteinKeys.get(row));
                return peptideShakerGUI.getDisplayFeaturesGenerator().addDatabaseLink(proteinMatch.getMainMatch());
            } else if (column == 2) {
                ProteinMatch proteinMatch = identification.getProteinMatch(proteinKeys.get(row));
                String description = "";
                try {
                    description = sequenceFactory.getHeader(proteinMatch.getMainMatch()).getSimpleProteinDescription();
                } catch (Exception e) {
                    peptideShakerGUI.catchException(e);
                }
                return description;
            } else if (column > 2 && column - 3 < fileNames.size()) {
                String fraction = fileNames.get(column - 3);
                PSParameter psParameter = new PSParameter();
                String proteinKey = proteinKeys.get(row);
                psParameter = (PSParameter) identification.getProteinMatchParameter(proteinKey, psParameter);
                if (psParameter.getFractions() != null && psParameter.getFractions().contains(fraction)) {
                    return psParameter.getFractionConfidence(fraction);
                } else {
                    return 0.0;
                }
            } else if (column == fileNames.size() + 3) {
                ProteinMatch proteinMatch = identification.getProteinMatch(proteinKeys.get(row));
                String mainMatch = proteinMatch.getMainMatch();
                Protein currentProtein = sequenceFactory.getProtein(mainMatch);
                if (currentProtein != null) {
                    return sequenceFactory.computeMolecularWeight(mainMatch);
                } else {
                    return null;
View Full Code Here

                                return DisplayPreferences.LOADING_MESSAGE;
                            }
                        }
                        return psParameter.getProteinInferenceClass();
                    case 3:
                        ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey, useDB && !isScrolling);
                        if (proteinMatch == null) {
                            if (isScrolling) {
                                return null;
                            } else if (!useDB) {
                                dataMissingAtRow(row);
                                return DisplayPreferences.LOADING_MESSAGE;
                            }
                        }
                        if (!isScrolling) {
                            return displayFeaturesGenerator.addDatabaseLink(proteinMatch.getMainMatch());
                        } else {
                            return proteinMatch.getMainMatch();
                        }
                    case 4:
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB && !isScrolling);
                        if (proteinMatch == null) {
                            if (isScrolling) {
                                return null;
                            } else if (!useDB) {
                                dataMissingAtRow(row);
                                return DisplayPreferences.LOADING_MESSAGE;
                            }
                        }
                        String description = null;
                        try {
                            description = sequenceFactory.getHeader(proteinMatch.getMainMatch()).getSimpleProteinDescription();

                            // if description is not set, return the accession instead - fix for home made fasta headers
                            if (description == null || description.trim().isEmpty()) {
                                description = proteinMatch.getMainMatch();
                            }
                        } catch (Exception e) {
                            exceptionHandler.catchException(e);
                        }
                        return description;
                    case 5:
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB && !isScrolling);
                        if (proteinMatch == null) {
                            if (isScrolling) {
                                return null;
                            } else if (!useDB) {
                                dataMissingAtRow(row);
                                return DisplayPreferences.LOADING_MESSAGE;
                            }
                        }
                        String geneName = sequenceFactory.getHeader(proteinMatch.getMainMatch()).getGeneName();
                        String chromosomeNumber = geneFactory.getChromosomeForGeneName(geneName);
                        return new Chromosome(chromosomeNumber);
                    case 6:
                        if (isScrolling) {
                            return null;
                        }
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB);
                        if (!useDB && (!identificationFeaturesGenerator.sequenceCoverageInCache(proteinKey)
                                || !identificationFeaturesGenerator.observableCoverageInCache(proteinKey))
                                && (proteinMatch == null || !identification.proteinDetailsInCache(proteinKey))) {
                            dataMissingAtRow(row);
                            return DisplayPreferences.LOADING_MESSAGE;
                        }
                        HashMap<Integer, Double> sequenceCoverage;
                        try {
                            sequenceCoverage = identificationFeaturesGenerator.getSequenceCoverage(proteinKey);
                        } catch (Exception e) {
                            exceptionHandler.catchException(e);
                            return Double.NaN;
                        }
                        Double sequenceCoverageConfident = 100 * sequenceCoverage.get(MatchValidationLevel.confident.getIndex());
                        Double sequenceCoverageDoubtful = 100 * sequenceCoverage.get(MatchValidationLevel.doubtful.getIndex());
                        Double sequenceCoverageNotValidated = 100 * sequenceCoverage.get(MatchValidationLevel.not_validated.getIndex());
                        double possibleCoverage = 100;
                        try {
                            possibleCoverage = 100 * identificationFeaturesGenerator.getObservableCoverage(proteinKey);
                        } catch (Exception e) {
                            exceptionHandler.catchException(e);
                        }
                        ArrayList<Double> doubleValues = new ArrayList<Double>();
                        doubleValues.add(sequenceCoverageConfident);
                        doubleValues.add(sequenceCoverageDoubtful);
                        doubleValues.add(sequenceCoverageNotValidated);
                        doubleValues.add(possibleCoverage - sequenceCoverageConfident - sequenceCoverageDoubtful - sequenceCoverageNotValidated);
                        ArrrayListDataPoints arrrayListDataPoints = new ArrrayListDataPoints(doubleValues, JSparklinesArrayListBarChartTableCellRenderer.ValueDisplayType.sumExceptLastNumber);
                        return arrrayListDataPoints;
                    case 7:
                        if (isScrolling) {
                            return null;
                        }
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB);
                        if (!useDB && (proteinMatch == null
                                || !identificationFeaturesGenerator.nValidatedPeptidesInCache(proteinKey)
                                && !identification.proteinDetailsInCache(proteinKey))) {
                            dataMissingAtRow(row);
                            return DisplayPreferences.LOADING_MESSAGE;
                        }
                        double nConfidentPeptides = identificationFeaturesGenerator.getNConfidentPeptides(proteinKey);
                        double nDoubtfulPeptides = identificationFeaturesGenerator.getNValidatedPeptides(proteinKey) - nConfidentPeptides;

                        doubleValues = new ArrayList<Double>();
                        doubleValues.add(nConfidentPeptides);
                        doubleValues.add(nDoubtfulPeptides);
                        doubleValues.add(proteinMatch.getPeptideCount() - nConfidentPeptides - nDoubtfulPeptides);
                        arrrayListDataPoints = new ArrrayListDataPoints(doubleValues, JSparklinesArrayListBarChartTableCellRenderer.ValueDisplayType.sumOfNumbers);
                        return arrrayListDataPoints;
                    case 8:
                        if (isScrolling) {
                            return null;
                        }
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB);
                        if (!useDB
                                && (!identificationFeaturesGenerator.nValidatedSpectraInCache(proteinKey)
                                || !identificationFeaturesGenerator.nSpectraInCache(proteinKey))
                                && (proteinMatch == null || !identification.proteinDetailsInCache(proteinKey))) {
                            dataMissingAtRow(row);
                            return DisplayPreferences.LOADING_MESSAGE;
                        }
                        double nConfidentSpectra = identificationFeaturesGenerator.getNConfidentSpectra(proteinKey);
                        double nDoubtfulSpectra = identificationFeaturesGenerator.getNValidatedSpectra(proteinKey) - nConfidentSpectra;
                        int nSpectra = identificationFeaturesGenerator.getNSpectra(proteinKey);

                        doubleValues = new ArrayList<Double>();
                        doubleValues.add(nConfidentSpectra);
                        doubleValues.add(nDoubtfulSpectra);
                        doubleValues.add(nSpectra - nConfidentSpectra - nDoubtfulSpectra);
                        arrrayListDataPoints = new ArrrayListDataPoints(doubleValues, JSparklinesArrayListBarChartTableCellRenderer.ValueDisplayType.sumOfNumbers);
                        return arrrayListDataPoints;
                    case 9:
                        if (isScrolling) {
                            return null;
                        }
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB);
                        if (!useDB && !identificationFeaturesGenerator.spectrumCountingInCache(proteinKey)
                                && (proteinMatch == null || !identification.proteinDetailsInCache(proteinKey))) {
                            dataMissingAtRow(row);
                            return DisplayPreferences.LOADING_MESSAGE;
                        }
                        return identificationFeaturesGenerator.getSpectrumCounting(proteinKey);
                    case 10:
                        if (isScrolling) {
                            return null;
                        }
                        proteinMatch = identification.getProteinMatch(proteinKey, useDB);
                        if (!useDB && proteinMatch == null) {
                            dataMissingAtRow(row);
                            return DisplayPreferences.LOADING_MESSAGE;
                        }
                        String mainMatch = proteinMatch.getMainMatch();
                        Protein currentProtein = sequenceFactory.getProtein(mainMatch);
                        if (currentProtein != null) {
                            return sequenceFactory.computeMolecularWeight(mainMatch);
                        } else {
                            return null;
View Full Code Here

TOP

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

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.