Examples of MSnSpectrum


Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

            for (int row : selectedRows) {

                SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
                int psmIndex = tableModel.getViewIndex(row);
                String spectrumKey = psmKeys.get(psmIndex);
                MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(spectrumKey);

                if (currentSpectrum != null && peptideTable.getSelectedRow() != -1) {

                    SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);

                    // get the spectrum annotations
                    PeptideAssumption peptideAssumption = spectrumMatch.getBestPeptideAssumption();
                    annotationPreferences.setCurrentSettings(peptideAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumKey), peptideShakerGUI.getSequenceMatchingPreferences());
                    ArrayList<IonMatch> annotations = miniAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                            annotationPreferences.getNeutralLosses(),
                            annotationPreferences.getValidatedCharges(),
                            spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value,
                            currentSpectrum, peptideAssumption.getPeptide(),
                            currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                            annotationPreferences.getFragmentIonAccuracy(), false,
                            annotationPreferences.isHighResolutionAnnotation());
                    allAnnotations.add(annotations);
                    currentSpectrumKey = spectrumKey;
                }
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

    private ArrayList<MSnSpectrum> getSelectedSpectra() throws MzMLUnmarshallerException {

        ArrayList<MSnSpectrum> allSpectra = new ArrayList<MSnSpectrum>();

        int[] selectedRows = psmTable.getSelectedRows();
        MSnSpectrum tempSpectrum;

        SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
        for (int row : selectedRows) {
            int psmIndex = tableModel.getViewIndex(row);
            String spectrumKey = psmKeys.get(psmIndex);
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

            SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
            for (int row : selectedRows) {
                int psmIndex = tableModel.getViewIndex(row);
                String spectrumKey = psmKeys.get(psmIndex);
                MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(spectrumKey);
                spectraAsMgf.append(currentSpectrum.asMgf());
            }

            return spectraAsMgf.toString();
        }
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

     * Update the number of surrounding amino acids displayed.
     */
    public void updateSurroundingAminoAcids() {
        if (!peptideShakerGUI.getSelectedPsmKey().equals(PeptideShakerGUI.NO_SELECTION)) {
            try {
                MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(peptideShakerGUI.getSelectedPsmKey());
                updateSpectrumPanelBorderTitle(currentSpectrum);
            } catch (IOException e) {
                peptideShakerGUI.catchException(e);
            }
        }
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

        TagSpectrumAnnotator spectrumAnnotator = new TagSpectrumAnnotator();
        int keySize = key.length();
        ArrayList<Integer> charges = new ArrayList<Integer>(1);
        charges.add(1); //@TODO: use other charges?
        String spectrumKey = spectrumMatch.getKey();
        MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumKey);
        HashMap<Integer, HashMap<String, ArrayList<TagAssumption>>> tagAssumptionsMap = spectrumMatch.getTagAssumptionsMap(keySize, sequenceMatchingPreferences);
        for (int advocateId : tagAssumptionsMap.keySet()) {
            HashMap<String, ArrayList<TagAssumption>> algorithmTags = tagAssumptionsMap.get(advocateId);
            ArrayList<TagAssumption> tagAssumptions = algorithmTags.get(key);
            if (tagAssumptions != null) {
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

            }

            // add the fragment ion annotation
            int identificationCharge = bestPeptideAssumption.getIdentificationCharge().value;
            annotationPreferences.setCurrentSettings(bestPeptideAssumption, true, sequenceMatchingPreferences);
            MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumFileName, spectrumTitle);

            // get all the fragment ion annotations
            ArrayList<IonMatch> annotations = peptideSpectrumAnnotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
                    annotationPreferences.getNeutralLosses(),
                    annotationPreferences.getValidatedCharges(),
                    identificationCharge,
                    spectrum, bestPeptideAssumption.getPeptide(),
                    spectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                    annotationPreferences.getFragmentIonAccuracy(), false,
                    annotationPreferences.isHighResolutionAnnotation());

            // organize the fragment ions by ion type
            HashMap<String, HashMap<Integer, ArrayList<IonMatch>>> allFragmentIons = new HashMap<String, HashMap<Integer, ArrayList<IonMatch>>>();
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

            throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException, MzMLUnmarshallerException {

        SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
        PeptideAssumption bestAssumption = spectrumMatch.getBestPeptideAssumption();
        Peptide peptide = bestAssumption.getPeptide();
        MSnSpectrum spectrum = (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey);

        if (accessions == null) {
            accessions = peptide.getParentProteins(sequenceMatchingPreferences);
        }
        PTMFactory ptmFactory = PTMFactory.getInstance();
        PtmToPrideMap ptmToPrideMap = null;
        // get the psi-mod mappings
        try {
            PrideObjectsFactory prideObjectsFactory = PrideObjectsFactory.getInstance();
            ptmToPrideMap = prideObjectsFactory.getPtmToPrideMap();
        } catch (Exception e) {
            e.printStackTrace();
        }

        for (String accession : accessions) {

            PeptideSpectrumAnnotator spectrumAnnotator = new PeptideSpectrumAnnotator();

            ArrayList<IonMatch> annotations = spectrumAnnotator.getSpectrumAnnotation(
                    annotationPreferences.getIonTypes(),
                    annotationPreferences.getNeutralLosses(),
                    annotationPreferences.getValidatedCharges(),
                    spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value,
                    spectrum,
                    spectrumMatch.getBestPeptideAssumption().getPeptide(),
                    spectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
                    annotationPreferences.getFragmentIonAccuracy(), false,
                    annotationPreferences.isHighResolutionAnnotation());

            for (IonMatch ionMatch : annotations) {

                if (ionMatch.ion.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION) {

                    PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ionMatch.ion;

                    if (peptideFragmentIon.getNeutralLosses().isEmpty()) {

                        //Q1
                        Charge charge = bestAssumption.getIdentificationCharge();
                        double theoreticPrecMz = (peptide.getMass() + charge.value * ElementaryIon.proton.getTheoreticMass()) / charge.value;
                        writer.write(theoreticPrecMz + SEPARATOR);

                        //Q3
                        double theoreticFragMz = ionMatch.ion.getTheoreticMz(charge.value);
                        writer.write(theoreticFragMz + SEPARATOR);

                        // RT_detected
                        double rt = spectrum.getPrecursor().getRt();
                        writer.write(rt + SEPARATOR);

                        // isotope
                        writer.write("Light" + SEPARATOR);

View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

                                    peptideAssumptions.get(p).get(proteinMax).get(nSE).get(-1.0).put(-1.0, assumptions);
                                } else {
                                    HashMap<Ion.IonType, HashSet<Integer>> iontypes = annotationPreferences.getIonTypes();
                                    NeutralLossesMap neutralLosses = annotationPreferences.getNeutralLosses();
                                    ArrayList<Integer> charges = annotationPreferences.getValidatedCharges();
                                    MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumKey);
                                    double mzTolerance = searchParameters.getFragmentIonAccuracy();
                                    boolean isPpm = false; //@TODO change this as soon as search engine support fragment ion tolerance in ppm

                                    if (peptideAssumptions.get(p).get(proteinMax).get(nSE).containsKey(-1.0)) {
                                        ArrayList<PeptideAssumption> assumptions = peptideAssumptions.get(p).get(proteinMax).get(nSE).get(-1.0).get(-1.0);
                                        PeptideAssumption tempAssumption = assumptions.get(0);
                                        Peptide peptide = tempAssumption.getPeptide();
                                        int precursorCharge = tempAssumption.getIdentificationCharge().value;
                                        annotationPreferences.setCurrentSettings(tempAssumption, true, sequenceMatchingPreferences);
                                        double nIons = spectrumAnnotator.getCoveredAminoAcids(iontypes, neutralLosses, charges, precursorCharge,
                                                spectrum, peptide, 0, mzTolerance, isPpm, annotationPreferences.isHighResolutionAnnotation()).keySet().size();
                                        double coverage = nIons / peptide.getSequence().length();
                                        peptideAssumptions.get(p).get(proteinMax).get(nSE).put(coverage, new HashMap<Double, ArrayList<PeptideAssumption>>());
                                        peptideAssumptions.get(p).get(proteinMax).get(nSE).get(coverage).put(-1.0, assumptions);
                                        peptideAssumptions.get(p).get(proteinMax).get(nSE).remove(-1.0);
                                    }

                                    Peptide peptide = peptideAssumption1.getPeptide();
                                    int precursorCharge = peptideAssumption1.getIdentificationCharge().value;
                                    annotationPreferences.setCurrentSettings(peptideAssumption1, true, sequenceMatchingPreferences);
                                    double nIons = spectrumAnnotator.getCoveredAminoAcids(iontypes, neutralLosses, charges, precursorCharge,
                                            spectrum, peptide, 0, mzTolerance, isPpm, annotationPreferences.isHighResolutionAnnotation()).keySet().size();
                                    double coverage = nIons / peptide.getSequence().length();

                                    HashMap<Double, ArrayList<PeptideAssumption>> coverageMap = peptideAssumptions.get(p).get(proteinMax).get(nSE).get(coverage);
                                    if (coverageMap == null) {
                                        coverageMap = new HashMap<Double, ArrayList<PeptideAssumption>>();
                                        ArrayList<PeptideAssumption> assumptions = new ArrayList<PeptideAssumption>();
                                        assumptions.add(peptideAssumption1);
                                        coverageMap.put(-1.0, assumptions);
                                        peptideAssumptions.get(p).get(proteinMax).get(nSE).put(coverage, coverageMap);
                                    } else {
                                        ArrayList<PeptideAssumption> assumptions = coverageMap.get(-1.0);
                                        if (assumptions != null) {
                                            PeptideAssumption tempAssumption = assumptions.get(0);
                                            double massError = Math.abs(tempAssumption.getDeltaMass(spectrum.getPrecursor().getMz(), searchParameters.isPrecursorAccuracyTypePpm()));
                                            peptideAssumptions.get(p).get(proteinMax).get(nSE).get(coverage).put(massError, assumptions);
                                            peptideAssumptions.get(p).get(proteinMax).get(nSE).get(coverage).remove(-1.0);
                                        }

                                        double massError = Math.abs(peptideAssumption1.getDeltaMass(spectrum.getPrecursor().getMz(), searchParameters.isPrecursorAccuracyTypePpm()));
                                        assumptions = coverageMap.get(massError);

                                        if (assumptions == null) {
                                            assumptions = new ArrayList<PeptideAssumption>();
                                            coverageMap.put(massError, assumptions);
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

            try {
                for (String spectrumTitle : spectrumFactory.getSpectrumTitles(fileName)) {

                    String spectrumKey = Spectrum.getSpectrumKey(fileName, spectrumTitle);

                    MSnSpectrum spectrum = null;
                    if (recalibrate) {
                        spectrum = spectrumRecalibrator.recalibrateSpectrum(fileName, spectrumTitle, true, true);
                        spectrum.writeMgf(writerRecalibration);
                    }
                    if (identification.matchExists(spectrumKey)) {
                        psParameter = (PSParameter) identification.getSpectrumMatchParameter(spectrumKey, psParameter);
                        Integer charge = new Integer(psParameter.getSpecificMapKey());
                        String spectrumFile = Spectrum.getSpectrumFile(spectrumKey);
                        Double fdrThreshold = getFdrThreshold(psmTargetDecoyMap, charge, spectrumTitle, fdr);
                        double confidenceLevel = getHighConfidenceThreshold(psmTargetDecoyMap, charge, spectrumFile, fdrThreshold);
                        if (psParameter.getPsmConfidence() >= confidenceLevel) {
                            if (spectrum == null) {
                                spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumKey);
                            }
                            SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
                            if (spectrumMatch.getBestPeptideAssumption() != null) {
                                String sequence = spectrumMatch.getBestPeptideAssumption().getPeptide().getSequence();
                                HashMap<String, String> tags = new HashMap<String, String>();
                                tags.put("SEQ", sequence);
                                spectrum.writeMgf(writerGood, tags);
                            }
                        }
                        confidenceLevel = getLowConfidenceThreshold(psmTargetDecoyMap, charge, spectrumFile, fnr, fdrThreshold);
                        if (psParameter.getPsmConfidence() <= confidenceLevel) {
                            if (spectrum == null) {
                                spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumKey);
                            }
                            spectrum.writeMgf(writerBad);
                        }
                    }

                    if (waitingHandler != null) {
                        if (waitingHandler.isRunCanceled()) {
View Full Code Here

Examples of com.compomics.util.experiment.massspectrometry.MSnSpectrum

            }
        }

        if (!modifications.isEmpty()) {

            MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(spectrumMatch.getKey());
            annotationPreferences.setCurrentSettings(spectrumMatch.getBestPeptideAssumption(), true, sequenceMatchingPreferences);

            for (Double ptmMass : modifications.keySet()) {
                HashMap<Integer, Double> scores = null;
                if (scoringPreferences.getSelectedProbabilisticScore() == PtmScore.AScore && nMod.get(ptmMass) == 1) {
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.