Package eu.isas.peptideshaker.scoring.targetdecoy

Examples of eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap


                int cpt = 0;

                modifiedMaps.put(cpt, false);
                ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[]{cpt + 1, "Proteins"});
                TargetDecoyMap targetDecoyMap = pSMaps.getProteinMap().getTargetDecoyMap();
                TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                originalThresholdTypes.put(cpt, targetDecoyResults.getInputType());
                originalThresholds.put(cpt, targetDecoyResults.getUserInput());

                ArrayList<String> peptideKeys = pSMaps.getPeptideSpecificMap().getKeys();
                if (peptideKeys.size() == 1) {
                    String key = peptideKeys.get(0);
                    peptideMap.put(++cpt, key);
                    modifiedMaps.put(cpt, false);
                    ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[]{cpt + 1, "Peptides"});
                    targetDecoyMap = pSMaps.getPeptideSpecificMap().getTargetDecoyMap(key);
                    targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                    originalThresholdTypes.put(cpt, targetDecoyResults.getInputType());
                    originalThresholds.put(cpt, targetDecoyResults.getUserInput());
                } else {
                    for (String peptideKey : peptideKeys) {

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

                        peptideMap.put(++cpt, peptideKey);
                        modifiedMaps.put(cpt, false);

                        String title = PeptideSpecificMap.getKeyName(peptideShakerGUI.getSearchParameters().getModificationProfile(), peptideKey);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[]{cpt + 1, title + " Peptides"});
                    }
                }

                PsmSpecificMap psmSpecificMap = pSMaps.getPsmSpecificMap();
                ArrayList<Integer> foundCharges = new ArrayList<Integer>();
                HashMap<Integer, ArrayList<Integer>> groupedCharges = new HashMap<Integer, ArrayList<Integer>>();
                for (Integer charge : psmSpecificMap.getPossibleCharges()) {
                    for (String file : psmSpecificMap.getFilesAtCharge(charge)) {
                        if (!psmSpecificMap.isFileGrouped(charge, file)) {
                            foundCharges.add(charge);
                            if (progressDialog.isRunCanceled()) {
                                break;
                            }
                            HashMap<Integer, String> psmKey = new HashMap<Integer, String>();
                            psmKey.put(charge, file);
                            psmMap.put(++cpt, psmKey);
                            modifiedMaps.put(cpt, false);
                            targetDecoyMap = pSMaps.getPsmSpecificMap().getTargetDecoyMap(charge, file);
                            targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                            originalThresholdTypes.put(cpt, targetDecoyResults.getInputType());
                            originalThresholds.put(cpt, targetDecoyResults.getUserInput());
                        }
                    }
                }
                for (int charge : psmSpecificMap.getChargesFromGroupedFiles()) {
                    int correctedCharge = psmSpecificMap.getCorrectedCharge(charge);
                    if (correctedCharge == charge) {
                        HashMap<Integer, String> psmKey = new HashMap<Integer, String>();
                        psmKey.put(charge, null);
                        psmMap.put(++cpt, psmKey);
                        modifiedMaps.put(cpt, false);
                        targetDecoyMap = pSMaps.getPsmSpecificMap().getTargetDecoyMap(charge, null);
                        targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put(cpt, targetDecoyResults.getInputType());
                        originalThresholds.put(cpt, targetDecoyResults.getUserInput());
                    } else {
                        ArrayList<Integer> charges = groupedCharges.get(correctedCharge);
                        if (charges == null) {
View Full Code Here


        if (selectedFileName == null) {
            for (String spectrumFile : identification.getSpectrumFiles()) {
                totalNumberOfSpectra += spectrumFactory.getNSpectra(spectrumFile);
            }
            for (int advocateId : inputMap.getInputAlgorithmsSorted()) {
                TargetDecoyMap targetDecoyMap = inputMap.getTargetDecoyMap(advocateId);
                TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                double nTP;
                if (targetDecoyResults == null) {
                    nTP = 0;
                } else {
                    nTP = targetDecoyResults.getnTP();
                }
                searchEngineTP.put(advocateId, nTP);
                double nFN;
                if (targetDecoyResults == null) {
                    nFN = 0;
                } else {
                    nFN = targetDecoyResults.getnTPTotal() - nTP;
                }
                searchEngineFN.put(advocateId, nFN);
                double contribution = inputMap.getAdvocateContribution(advocateId);
                searchEngineContribution.put(advocateId, contribution);
                double uniqueContribution = inputMap.getAdvocateUniqueContribution(advocateId);
                searchEngineUniqueContribution.put(advocateId, uniqueContribution);
            }
            double nTP = 0;
            double totalTP = 0;
            for (TargetDecoyMap targetDecoyMap : psmSpecificMap.getTargetDecoyMaps()) {
                TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                nTP += targetDecoyResults.getnTP();
                totalTP += targetDecoyResults.getnTPTotal();
            }
            searchEngineTP.put(Advocate.peptideShaker.getIndex(), nTP);
            double nFN = totalTP - nTP;
            searchEngineFN.put(Advocate.peptideShaker.getIndex(), nFN);
        } else {
            totalNumberOfSpectra = spectrumFactory.getNSpectra(selectedFileName);
            for (int advocateId : inputMap.getInputAlgorithmsSorted()) {
                TargetDecoyMap targetDecoyMap = inputMap.getTargetDecoyMap(advocateId, selectedFileName);
                TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                double nTP;
                if (targetDecoyResults == null) {
                    nTP = 0;
                } else {
                    nTP = targetDecoyResults.getnTP();
View Full Code Here

        for (String spectrumFileName : identification.getSpectrumFiles()) {
            for (int advocateIndex : inputMap.getIntermediateScoreInputAlgorithms(spectrumFileName)) {
                ArrayList<Integer> scores = processingPreferences.getScores(advocateIndex);
                if (scores.size() > 1) {
                    for (int scoreIndex : scores) {
                        TargetDecoyMap targetDecoyMap = inputMap.getIntermediateScoreMap(spectrumFileName, advocateIndex, scoreIndex);
                        totalProgress += targetDecoyMap.getMapSize();
                    }
                }
            }
        }

        waitingHandler.setSecondaryProgressCounterIndeterminate(false);
        waitingHandler.setMaxSecondaryProgressCounter(totalProgress);

        for (String spectrumFileName : identification.getSpectrumFiles()) {
            for (int advocateIndex : inputMap.getIntermediateScoreInputAlgorithms(spectrumFileName)) {
                ArrayList<Integer> scores = processingPreferences.getScores(advocateIndex);
                if (scores.size() > 1) {
                    for (int scoreIndex : scores) {
                        TargetDecoyMap targetDecoyMap = inputMap.getIntermediateScoreMap(spectrumFileName, advocateIndex, scoreIndex);
                        targetDecoyMap.estimateProbabilities(waitingHandler);
                        if (waitingHandler.isRunCanceled()) {
                            return;
                        }
                    }
                }
View Full Code Here

                                if (scores.size() == 1 || !sequenceFactory.concatenatedTargetDecoy()) {
                                    score = psParameter.getIntermediateScore(scores.get(0));
                                } else {
                                    for (int scoreIndex : scores) {
                                        TargetDecoyMap targetDecoyMap = inputMap.getIntermediateScoreMap(spectrumFileName, advocateIndex, scoreIndex);
                                        Double intermediateScore = psParameter.getIntermediateScore(scoreIndex);
                                        if (intermediateScore != null) {
                                            double p = targetDecoyMap.getProbability(intermediateScore);
                                            score *= p;
                                        }
                                    }
                                }

View Full Code Here

     * @param eValue The search engine e-value
     * @param isDecoy boolean indicating whether the hit was decoy or target
     * (resp. true/false)
     */
    public synchronized void addEntry(int searchEngine, String spectrumFileName, double eValue, boolean isDecoy) {
        TargetDecoyMap targetDecoyMap = inputMap.get(searchEngine);
        if (targetDecoyMap == null) {
            targetDecoyMap = new TargetDecoyMap();
            inputMap.put(searchEngine, targetDecoyMap);
        }
        targetDecoyMap.put(eValue, isDecoy);
        HashMap<String, TargetDecoyMap> algorithmMap = inputSpecificMap.get(searchEngine);
        if (algorithmMap == null) {
            algorithmMap = new HashMap<String, TargetDecoyMap>();
            inputSpecificMap.put(searchEngine, algorithmMap);
        }
        targetDecoyMap = algorithmMap.get(spectrumFileName);
        if (targetDecoyMap == null) {
            targetDecoyMap = new TargetDecoyMap();
            algorithmMap.put(spectrumFileName, targetDecoyMap);
        }
        targetDecoyMap.put(eValue, isDecoy);
    }
View Full Code Here

        HashMap<Integer, TargetDecoyMap> scoreMap = advocateMap.get(advocateIndex);
        if (scoreMap == null) {
            scoreMap = new HashMap<Integer, TargetDecoyMap>();
            advocateMap.put(advocateIndex, scoreMap);
        }
        TargetDecoyMap targetDecoyMap = scoreMap.get(scoreIndex);
        if (targetDecoyMap == null) {
            targetDecoyMap = new TargetDecoyMap();
            scoreMap.put(scoreIndex, targetDecoyMap);
        }
        targetDecoyMap.put(score, decoy);
    }
View Full Code Here

    public TargetDecoyMap getIntermediateScoreMap(String fileName, int advocateIndex, int scoreIndex) {
        HashMap<Integer, HashMap<Integer, TargetDecoyMap>> advocateMap = intermediateScores.get(fileName);
        if (advocateMap != null) {
            HashMap<Integer, TargetDecoyMap> scoreMap = advocateMap.get(advocateIndex);
            if (scoreMap != null) {
                TargetDecoyMap targetDecoyMap = scoreMap.get(scoreIndex);
                return targetDecoyMap;
            }
        }
        return null;
    }
View Full Code Here

            psmMaps.put(ptmMass, new HashMap<Integer, TargetDecoyMap>());
            grouping.put(ptmMass, new HashMap<Integer, Integer>());
        }
        int key = getKey(spectrumMatch);
        if (!psmMaps.get(ptmMass).containsKey(key)) {
            psmMaps.get(ptmMass).put(key, new TargetDecoyMap());
        }
        psmMaps.get(ptmMass).get(key).put(probabilityScore, false);
        if (conflict) {
            psmMaps.get(ptmMass).get(key).put(probabilityScore, true);
        }
View Full Code Here

        if (groupedFile) {
            Integer key = grouping.get(charge);
            if (key == null) {
                key = charge;
            }
            TargetDecoyMap targetDecoyMap = psmsMaps.get(key);
            if (targetDecoyMap == null) {
                return 1;
            }
            return targetDecoyMap.getProbability(score);
        }
        HashMap<String, TargetDecoyMap> specificMap = fileSpecificPsmsMaps.get(charge);
        if (specificMap == null) {
            return 1;
        }
        TargetDecoyMap targetDecoyMap = specificMap.get(file);
        if (targetDecoyMap == null) {
            return 1;
        }
        return targetDecoyMap.getProbability(score);
    }
View Full Code Here

        if (fileMapping == null) {
            fileMapping = new HashMap<String, TargetDecoyMap>();
            fileSpecificPsmsMaps.put(charge, fileMapping);
        }
        String file = Spectrum.getSpectrumFile(spectrumMatch.getKey());
        TargetDecoyMap targetDecoyMap = fileMapping.get(file);
        if (targetDecoyMap == null) {
            targetDecoyMap = new TargetDecoyMap();
            fileMapping.put(file, targetDecoyMap);
        }
        targetDecoyMap.put(probabilityScore, spectrumMatch.getBestPeptideAssumption().getPeptide().isDecoy(sequenceMatchingPreferences));
    }
View Full Code Here

TOP

Related Classes of eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap

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.