Package com.compomics.util.experiment.biology

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


            mainMatch = proteinMatchKey;
        } else {
            ProteinMatch proteinMatch = identification.getProteinMatch(proteinMatchKey);
            mainMatch = proteinMatch.getMainMatch();
        }
        Protein currentProtein = sequenceFactory.getProtein(mainMatch);
        double lengthMax = idFilter.getMaxPepLength();
        if (metrics.getPeptideLengthDistribution() != null) {
            lengthMax = Math.min(lengthMax, metrics.getPeptideLengthDistribution().getValueAtCumulativeProbability(0.99));
        }
        return ((double) currentProtein.getObservableLength(enyzme, lengthMax)) / currentProtein.getLength();
    }
View Full Code Here


                            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

//        if (fastaIndex != null) {
//            dbType = Header.getDatabaseTypeAsString(fastaIndex.getDatabaseType());
//        }
        // iterate all the protein sequences
        while (iterator.hasNext()) {
            Protein currentProtein = iterator.getNextProtein();
            br.write(getCurrentTabSpace() + "<DBSequence id=\"" + currentProtein.getAccession() + "\" "
                    + "accession=\"" + currentProtein.getAccession() + "\" searchDatabase_ref=\"" + "SearchDB_1" + "\" >" + System.getProperty("line.separator"));
            tabCounter++;
            //br.write(getCurrentTabSpace() + "<Seq>" + currentProtein.getSequence() + "</Seq>" + System.getProperty("line.separator"));
            writeCvTerm(new CvTerm("PSI-MS", "MS:1001088", "protein description", StringEscapeUtils.escapeHtml4(sequenceFactory.getHeader(currentProtein.getAccession()).getDescription())));
            tabCounter--;
            br.write(getCurrentTabSpace() + "</DBSequence>" + System.getProperty("line.separator"));

            waitingHandler.increasePrimaryProgressCounter();
View Full Code Here

                    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

                    ArrayList<Integer> indexes;
                    if (sequenceFactory == null) {
                        return null;
                    }
                    try {
                        Protein currentProtein = sequenceFactory.getProtein(proteinAccession);
                        String peptideSequence = Peptide.getSequence(peptideKey);
                        indexes = currentProtein.getPeptideStart(peptideSequence,
                                peptideShakerGUI.getSequenceMatchingPreferences());
                    } catch (IOException e) {
                        peptideShakerGUI.catchException(e);
                        return "IO Exception";
                    }
View Full Code Here

                        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

     */
    public void scorePTMs(Identification identification, ProteinMatch proteinMatch, SearchParameters searchParameters, AnnotationPreferences annotationPreferences,
            boolean scorePeptides, PTMScoringPreferences ptmScoringPreferences, SequenceMatchingPreferences sequenceMatchingPreferences) throws Exception {

        PSParameter psParameter = new PSParameter();
        Protein protein = null;
        identification.loadPeptideMatches(proteinMatch.getPeptideMatchesKeys(), null);
        identification.loadPeptideMatchParameters(proteinMatch.getPeptideMatchesKeys(), psParameter, null);

        HashMap<Integer, ArrayList<String>> confidentSites = new HashMap<Integer, ArrayList<String>>();
        HashMap<Integer, HashMap<Integer, ArrayList<String>>> ambiguousSites = new HashMap<Integer, HashMap<Integer, ArrayList<String>>>();

        ArrayList<String> peptideKeys = new ArrayList<String>(proteinMatch.getPeptideMatchesKeys());
        for (String peptideKey : peptideKeys) {
            psParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, psParameter);
            if (psParameter.getMatchValidationLevel().isValidated() && Peptide.isModified(peptideKey)) {
                PeptideMatch peptideMath = identification.getPeptideMatch(peptideKey);
                String peptideSequence = Peptide.getSequence(peptideKey);
                if (peptideMath.getUrParam(new PSPtmScores()) == null || scorePeptides) {
                    scorePTMs(identification, peptideMath, searchParameters, annotationPreferences, ptmScoringPreferences, sequenceMatchingPreferences);
                }
                PSPtmScores peptideScores = (PSPtmScores) peptideMath.getUrParam(new PSPtmScores());
                if (peptideScores != null) {

                    if (protein == null) {
                        protein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                    }
                    ArrayList<Integer> peptideStart = protein.getPeptideStart(peptideSequence,
                            sequenceMatchingPreferences);
                    for (int confidentSite : peptideScores.getConfidentSites()) {
                        for (int peptideTempStart : peptideStart) {
                            int siteOnProtein = peptideTempStart + confidentSite - 2;
                            ArrayList<String> modificationsAtSite = confidentSites.get(siteOnProtein);
View Full Code Here

    public HashMap<Integer, ArrayList<ResidueAnnotation>> getResidueAnnotation(String proteinMatchKey, SequenceMatchingPreferences sequenceMatchingPreferences, IdentificationFeaturesGenerator identificationFeaturesGenerator, Metrics metrics, Identification identification,
            boolean allPeptides, SearchParameters searchParameters, 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<ResidueAnnotation>> residueAnnotation = new HashMap<Integer, ArrayList<ResidueAnnotation>>(sequence.length());

        double[] coverage = identificationFeaturesGenerator.getCoverableAA(proteinMatchKey);
        double lastP = coverage[0];
        int lastIndex = 0;
        for (int i = 1; i < coverage.length; i++) {
            double p = coverage[i];
            if (p != lastP) {
                String annotation = (lastIndex + 1) + "-" + (i + 1);
                if (metrics.getPeptideLengthDistribution() != null) {
                    annotation += ", " + Util.roundDouble(100 * lastP, 1) + "% chance of coverage";
                } else if (lastP > 0.01) {
                    annotation += ", possible to cover";
                }
                ArrayList<ResidueAnnotation> annotations = new ArrayList<ResidueAnnotation>(1);
                annotations.add(new ResidueAnnotation(annotation, null, false));
                for (int j = lastIndex; j < i; j++) {
                    residueAnnotation.put(j, new ArrayList<ResidueAnnotation>(annotations));
                }
                lastP = p;
                lastIndex = i;
            }
        }
        int i = coverage.length;
        String annotation = (lastIndex + 1) + "-" + (i);
        if (metrics.getPeptideLengthDistribution() != null) {
            annotation += ", " + Util.roundDouble(100 * lastP, 1) + "% chance of coverage";
        } else if (lastP > 0.01) {
            annotation += ", possible to cover";
        }
        ArrayList<ResidueAnnotation> annotations = new ArrayList<ResidueAnnotation>(1);
        annotations.add(new ResidueAnnotation(annotation, null, false));
        for (int j = lastIndex; j < i; j++) {
            residueAnnotation.put(j, new ArrayList<ResidueAnnotation>(annotations));
        }

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

        for (String peptideKey : proteinMatch.getPeptideMatchesKeys()) {
            PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
            String peptideSequence = peptideMatch.getTheoreticPeptide().getSequence();
            boolean enzymaticPeptide = true;
            if (!allPeptides) {
                enzymaticPeptide = currentProtein.isEnzymaticPeptide(peptideSequence, searchParameters.getEnzyme(),
                        sequenceMatchingPreferences);
            }
            if (allPeptides || (enzymatic && enzymaticPeptide) || (!enzymatic && !enzymatic)) {
                String modifiedSequence = getTaggedPeptideSequence(peptideMatch, true, false, true);
                AminoAcidPattern aminoAcidPattern = new AminoAcidPattern(peptideSequence);
View Full Code Here

                                                }
                                            }
                                            if (showNonEnzymaticPeptidesColumn) {

                                                ArrayList<String> peptideKeys = proteinMatch.getPeptideMatchesKeys();
                                                Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                                                boolean allPeptidesEnzymatic = true;

                                                identification.loadPeptideMatches(peptideKeys, null);
                                                identification.loadPeptideMatchParameters(peptideKeys, peptidePSParameter, null);

                                                // see if we have non-tryptic peptides
                                                for (String peptideKey : peptideKeys) {

                                                    String peptideSequence = identification.getPeptideMatch(peptideKey).getTheoreticPeptide().getSequence();
                                                    peptidePSParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, peptidePSParameter);

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

                                                        boolean isEnzymatic = currentProtein.isEnzymaticPeptide(peptideSequence,
                                                                peptideShakerGUI.getSearchParameters().getEnzyme(),
                                                                peptideShakerGUI.getSequenceMatchingPreferences());

                                                        if (!isEnzymatic) {
                                                            allPeptidesEnzymatic = false;
View Full Code Here

                                                }
                                            }
                                            if (showNonEnzymaticPeptidesColumn) {

                                                ArrayList<String> peptideKeys = proteinMatch.getPeptideMatchesKeys();
                                                Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                                                boolean allPeptidesEnzymatic = true;

                                                identification.loadPeptideMatches(peptideKeys, null);
                                                identification.loadPeptideMatchParameters(peptideKeys, peptidePSParameter, null);

                                                // see if we have non-tryptic peptides
                                                for (String peptideKey : peptideKeys) {

                                                    String peptideSequence = identification.getPeptideMatch(peptideKey).getTheoreticPeptide().getSequence();
                                                    peptidePSParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, peptidePSParameter);

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

                                                        boolean isEnzymatic = currentProtein.isEnzymaticPeptide(peptideSequence,
                                                                peptideShakerGUI.getSearchParameters().getEnzyme(),
                                                                peptideShakerGUI.getSequenceMatchingPreferences());

                                                        if (!isEnzymatic) {
                                                            allPeptidesEnzymatic = false;
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.