Package com.compomics.util.experiment.biology

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


                        peptideKeys = new ArrayList<String>();
                    }
                }

                // get the current protein and protein sequence
                Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                String currentProteinSequence = sequenceFactory.getProtein(proteinMatch.getMainMatch()).getSequence();

                int[][] coverage = new int[fileNames.size()][currentProteinSequence.length() + 1];

                // get the chart data
                for (int i = 0; i < fileNames.size(); i++) {

                    String fraction = fileNames.get(i);

                    for (int j = 0; j < peptideKeys.size(); j++) {

                        String peptideKey = peptideKeys.get(j);

                        try {
                            psParameter = (PSParameter) peptideShakerGUI.getIdentification().getPeptideMatchParameter(peptideKey, psParameter);

                            if (psParameter.getFractions() != null && psParameter.getFractions().contains(fraction)) {
                                if (psParameter.getMatchValidationLevel().isValidated()) {

                                    String peptideSequence = Peptide.getSequence(peptideKey);

                                    boolean includePeptide = false;

                                    if (coverageShowAllPeptidesJRadioButtonMenuItem.isSelected()) {
                                        includePeptide = true;
                                    } else if (coverageShowEnzymaticPeptidesOnlyJRadioButtonMenuItem.isSelected()) {
                                        includePeptide = currentProtein.isEnzymaticPeptide(peptideSequence,
                                                peptideShakerGUI.getSearchParameters().getEnzyme(),
                                                peptideShakerGUI.getSequenceMatchingPreferences());
                                    } else if (coverageShowTruncatedPeptidesOnlyJRadioButtonMenuItem.isSelected()) {
                                        includePeptide = !currentProtein.isEnzymaticPeptide(peptideSequence,
                                                peptideShakerGUI.getSearchParameters().getEnzyme(),
                                                peptideShakerGUI.getSequenceMatchingPreferences());
                                    }

                                    if (includePeptide && selectedRows.length == 1) {
View Full Code Here


                        Double sequenceCoverageConfident = 100 * sequenceCoverage.get(MatchValidationLevel.confident.getIndex());
                        Double sequenceCoverageDoubtful = 100 * sequenceCoverage.get(MatchValidationLevel.doubtful.getIndex());
                        value = sequenceCoverageConfident + sequenceCoverageDoubtful;
                } else if (proteinSequenceLengthJRadioButton.isSelected()) {
                    ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
                    Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                    value = currentProtein.getSequence().length();
                }

                proteinParameter = (PSParameter) identification.getProteinMatchParameter(proteinKey, proteinParameter);

                if (!proteinParameter.isHidden()) {
View Full Code Here

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

        try {
            if (proteinTable.getSelectedRow() != -1) {

                SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) proteinTable.getModel();
                String proteinKey = proteinKeys.get(tableModel.getViewIndex(proteinTable.getSelectedRow()));
                Protein protein = sequenceFactory.getProtein(proteinKey);

                String clipboardString = protein.getSequence();
                StringSelection stringSelection = new StringSelection(clipboardString);
                Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                clipboard.setContents(stringSelection, peptideShakerGUI);

                JOptionPane.showMessageDialog(peptideShakerGUI, "Protein sequence copied to clipboard.", "Copied to Clipboard", JOptionPane.INFORMATION_MESSAGE);
View Full Code Here

     * @throws ClassNotFoundException
     * @throws SQLException
     */
    private void updateProteinSequenceCoveragePanelTitle(String proteinAccession) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException, SQLException {

        Protein currentProtein = sequenceFactory.getProtein(proteinAccession);
        currentProteinSequence = currentProtein.getSequence();
        SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) proteinTable.getModel();

        if (proteinTable.getSelectedRow() != -1) {

            String proteinKey = proteinKeys.get(tableModel.getViewIndex(proteinTable.getSelectedRow()));
View Full Code Here

                int peptideIndex = peptideTableModel.getViewIndex(peptideTable.getSelectedRow());
                String peptideKey = peptideKeys.get(peptideIndex);
                SelfUpdatingTableModel proteinTableModel = (SelfUpdatingTableModel) proteinTable.getModel();
                String proteinKey = proteinKeys.get(proteinTableModel.getViewIndex(proteinTable.getSelectedRow()));
                ProteinMatch proteinMatch = peptideShakerGUI.getIdentification().getProteinMatch(proteinKey);
                Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                HashMap<Integer, String[]> aaSurrounding = currentProtein.getSurroundingAA(Peptide.getSequence(peptideKey),
                        peptideShakerGUI.getDisplayPreferences().getnAASurroundingPeptides(), peptideShakerGUI.getSequenceMatchingPreferences());

                String before = "";
                String after = "";
View Full Code Here

                probabilities = (PSParameter) identification.getProteinMatchParameter(proteinKey, probabilities);
                double score = probabilities.getProteinProbabilityScore();
                int nPeptides = -proteinMatch.getPeptideMatchesKeys().size();
                int nSpectra = 0;

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

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

     */
    private int[] estimateAACoverage(String proteinMatchKey, boolean allPeptides, boolean enzymatic)
            throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException {

        ProteinMatch proteinMatch = identification.getProteinMatch(proteinMatchKey);
        Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
        String sequence = currentProtein.getSequence();

        HashMap<Integer, ArrayList<Integer>> aminoAcids = new HashMap<Integer, ArrayList<Integer>>();
        HashMap<Integer, boolean[]> coverage = new HashMap<Integer, boolean[]>();
        PSParameter pSParameter = new PSParameter();

        // batch load the required data
        identification.loadPeptideMatches(proteinMatch.getPeptideMatchesKeys(), null);
        identification.loadPeptideMatchParameters(proteinMatch.getPeptideMatchesKeys(), pSParameter, null);

        // iterate the peptides and store the coverage for each peptide validation level
        for (String peptideKey : proteinMatch.getPeptideMatchesKeys()) {
            String peptideSequence = Peptide.getSequence(peptideKey);
            boolean enzymaticPeptide = true;
            if (!allPeptides) {
                enzymaticPeptide = currentProtein.isEnzymaticPeptide(peptideSequence, searchParameters.getEnzyme(),
                        sequenceMatchingPreferences);
            }
            if (allPeptides || enzymatic && enzymaticPeptide || !enzymatic && !enzymaticPeptide) {
                pSParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, pSParameter);
                int validationLevel = pSParameter.getMatchValidationLevel().getIndex();
View Full Code Here

            if (peptidePSParameter.getMatchValidationLevel().isValidated()) {

                String peptideSequence = Peptide.getSequence(peptideKey);
                boolean enzymatic = false;
                for (String accession : ProteinMatch.getAccessions(proteinMatchKey)) {
                    Protein currentProtein = sequenceFactory.getProtein(accession);
                    if (currentProtein.isEnzymaticPeptide(peptideSequence, enzyme,
                            sequenceMatchingPreferences)) {
                        enzymatic = true;
                        break;
                    }
                }
View Full Code Here

                        for (String proteinKey : identification.getProteinMap().get(protein)) {
                            if (!possibleProteinMatches.contains(proteinKey)) {
                                try {
                                    testMatch = identification.getProteinMatch(proteinKey);
                                    if (testMatch.getPeptideMatchesKeys().contains(peptideKey)) {
                                        Protein currentProtein = sequenceFactory.getProtein(testMatch.getMainMatch());
                                        peptideOccurrence += currentProtein.getPeptideStart(peptideSequence,
                                                sequenceMatchingPreferences).size();
                                        possibleProteinMatches.add(proteinKey);
                                    }
                                } catch (Exception e) {
                                    // protein deleted due to protein inference issue and not deleted from the map in versions earlier than 0.14.6
                                    System.out.println("Non-existing protein key in protein map: " + proteinKey);
                                    e.printStackTrace();
                                }
                            }
                        }
                    }
                }

                if (possibleProteinMatches.isEmpty()) {
                    System.err.println("No protein found for the given peptide (" + peptideKey + ") when estimating NSAF of '" + proteinMatchKey + "'.");
                }

                double ratio = 1.0 / peptideOccurrence;

                identification.loadSpectrumMatchParameters(peptideMatch.getSpectrumMatches(), pSParameter, null);
                for (String spectrumMatchKey : peptideMatch.getSpectrumMatches()) {
                    pSParameter = (PSParameter) identification.getSpectrumMatchParameter(spectrumMatchKey, pSParameter);
                    if (!spectrumCountingPreferences.isValidatedHits() || pSParameter.getMatchValidationLevel().isValidated()) {
                        result += ratio;
                    }
                }
            }

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

            if (!enzyme.isSemiSpecific()) {
                result /= currentProtein.getObservableLength(enzyme, maxPepLength);
            } else {
                result /= currentProtein.getLength(); // @TODO: how to handle this for semi-specific??
            }

            if (new Double(result).isInfinite() || new Double(result).isNaN()) {
                result = 0.0;
            }

            return result;
        } else {

            // emPAI
            double result;

            if (spectrumCountingPreferences.isValidatedHits()) {

                result = 0;

                identification.loadPeptideMatchParameters(proteinMatch.getPeptideMatchesKeys(), pSParameter, null);
                for (String peptideKey : proteinMatch.getPeptideMatchesKeys()) {
                    pSParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, pSParameter);
                    if (pSParameter.getMatchValidationLevel().isValidated()) {
                        result++;
                    }
                }
            } else {
                result = proteinMatch.getPeptideCount();
            }

            Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
            result = Math.pow(10, result / currentProtein.getNCleavageSites(enzyme)) - 1;

            if (new Double(result).isInfinite() || new Double(result).isNaN()) {
                result = 0.0;
            }
View Full Code Here

TOP

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

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.