当前位置: 首页>>代码示例>>Java>>正文


Java Peptide.getModificationMatches方法代码示例

本文整理汇总了Java中com.compomics.util.experiment.biology.Peptide.getModificationMatches方法的典型用法代码示例。如果您正苦于以下问题:Java Peptide.getModificationMatches方法的具体用法?Java Peptide.getModificationMatches怎么用?Java Peptide.getModificationMatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.compomics.util.experiment.biology.Peptide的用法示例。


在下文中一共展示了Peptide.getModificationMatches方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getComplementaryIonsFeatures

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Returns the ms2pip features for the complementary ions of the given
 * peptide at the given charge.
 *
 * @param peptide the peptide
 * @param charge the charge
 * @param ionIndex the ion index
 *
 * @return the ms2pip features for the b ions
 */
public int[] getComplementaryIonsFeatures(Peptide peptide, int charge, int ionIndex) {

    char[] peptideSequence = peptide.getSequence().toCharArray();
    int sequenceLength = peptideSequence.length;
    char[] reversedSequence = new char[sequenceLength];
    for (int i = 0; i < sequenceLength; i++) {
        reversedSequence[i] = peptideSequence[sequenceLength - i - 1];
    }
    ArrayList<ModificationMatch> modificationMatches = peptide.getModificationMatches();
    ArrayList<ModificationMatch> reversedModificationMatches;
    if (modificationMatches != null) {
        reversedModificationMatches = new ArrayList<ModificationMatch>(modificationMatches.size());
        for (ModificationMatch modificationMatch : modificationMatches) {
            ModificationMatch reversedModificationMatch = new ModificationMatch(modificationMatch.getTheoreticPtm(), modificationMatch.isVariable(), sequenceLength - modificationMatch.getModificationSite() + 1);
            reversedModificationMatches.add(reversedModificationMatch);
        }
    } else {
        reversedModificationMatches = null;
    }

    return getIonsFeatures(reversedSequence, reversedModificationMatches, charge, ionIndex);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:33,代码来源:FeaturesGenerator.java

示例2: getPositionToScoreMap

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Returns a map PTM localization &gt; score.
 *
 * @param peptide the peptide of interest
 * @param noModPeptide the peptide without the variable modification of
 * interest
 * @param refPTM the PTM of interest
 * @param annotationPreferences the global annotation preferences
 * @param specificAnnotationPreferences the annotation preferences specific
 * to this peptide and spectrum
 * @param spectrumAnnotator the spectrum annotator which should be used to
 * annotate the spectrum
 * @param spectrum the spectrum of interest
 * @param spectrumMap the map of the extracted spectra: depth &gt; extracted
 * spectrum
 * @param possibleSites the possible modification sites
 *
 * @return a map PTM localization &gt; score
 *
 * @throws org.apache.commons.math.MathException exception thrown whenever a
 * math error occurred while computing the score or estimating the noise level
 * @throws java.lang.InterruptedException exception thrown if the thread is
 * interrupted
 */
public static HashMap<Integer, HashMap<Integer, Double>> getPositionToScoreMap(Peptide peptide, Peptide noModPeptide, ArrayList<Integer> possibleSites,
        MSnSpectrum spectrum, HashMap<Integer, MSnSpectrum> spectrumMap, AnnotationSettings annotationPreferences, SpecificAnnotationSettings specificAnnotationPreferences, PeptideSpectrumAnnotator spectrumAnnotator, PTM refPTM) throws MathException, InterruptedException {

    HashMap<Integer, HashMap<Integer, Double>> positionToScoreMap = new HashMap<Integer, HashMap<Integer, Double>>();

    int N = 0;

    for (ArrayList<Ion> fragmentIons : spectrumAnnotator.getExpectedIons(specificAnnotationPreferences, peptide).values()) {
        N += fragmentIons.size();
    }

    String sequence = noModPeptide.getSequence();
    int sequenceLength = sequence.length();

    for (int i = 0; i < spectrumMap.size(); i++) {

        double p = ((double) i + 1) / 100;

        for (int pos : possibleSites) {
            Peptide tempPeptide = new Peptide(noModPeptide.getSequence(), noModPeptide.getModificationMatches());
            int position;
            if (pos == 0) {
                position = 1;
            } else if (pos == sequenceLength + 1) {
                position = sequenceLength;
            } else {
                position = pos;
            }
            tempPeptide.addModificationMatch(new ModificationMatch(refPTM.getName(), true, position));

            ArrayList<IonMatch> matches = spectrumAnnotator.getSpectrumAnnotation(annotationPreferences, specificAnnotationPreferences,
                    spectrumMap.get(i), tempPeptide, false);
            int n = matches.size();

            BinomialDistribution distribution = new BinomialDistribution(N, p);
            Double bigP = distribution.getDescendingCumulativeProbabilityAt((double) n);
            Double score = -10 * MathUtils.log(10, bigP);
            HashMap<Integer, Double> scoresAtPosition = positionToScoreMap.get(pos);
            if (scoresAtPosition == null) {
                scoresAtPosition = new HashMap<Integer, Double>(2);
                positionToScoreMap.put(pos, scoresAtPosition);
            }
            scoresAtPosition.put(i + 1, score);
        }
    }
    return positionToScoreMap;
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:72,代码来源:AScore.java

示例3: getPTMPlotData

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Returns the PTM plot series in the JFreechart format for one PSM.
 *
 * @param peptide the peptide of interest
 * @param ptm the PTM to score
 * @param nPTM the amount of times the PTM is expected
 * @param spectrum the corresponding spectrum
 * @param annotationPreferences the annotation preferences
 * @param specificAnnotationPreferences the specific annotation preferences
 *
 * @return the PTM plot series in the JFreechart format for one PSM.
 * 
 * @throws java.lang.InterruptedException exception thrown if the thread is
 * interrupted
 * @throws org.apache.commons.math.MathException exception thrown if a math exception occurred when estimating the noise level 
 */
public static HashMap<PeptideFragmentIon, ArrayList<IonMatch>> getPTMPlotData(Peptide peptide, PTM ptm, int nPTM, MSnSpectrum spectrum,
        AnnotationSettings annotationPreferences, SpecificAnnotationSettings specificAnnotationPreferences) throws InterruptedException, MathException {

    //@TODO: use Peptide.getNoModPeptide instead
    Peptide noModPeptide = new Peptide(peptide.getSequence(), new ArrayList<ModificationMatch>());

    if (peptide.isModified()) {
        for (ModificationMatch modificationMatch : peptide.getModificationMatches()) {
            if (!modificationMatch.getTheoreticPtm().equals(ptm.getName())) {
                noModPeptide.addModificationMatch(modificationMatch);
            }
        }
    }

    PeptideSpectrumAnnotator spectrumAnnotator = new PeptideSpectrumAnnotator();
    HashMap<Integer, ArrayList<Ion>> fragmentIons
            = spectrumAnnotator.getExpectedIons(specificAnnotationPreferences, noModPeptide);
    HashMap<PeptideFragmentIon, ArrayList<IonMatch>> map = new HashMap<PeptideFragmentIon, ArrayList<IonMatch>>();

    for (int i = 0; i <= nPTM; i++) {

        spectrumAnnotator.setMassShift(i * ptm.getMass());

        ArrayList<IonMatch> matches = spectrumAnnotator.getSpectrumAnnotation(annotationPreferences, specificAnnotationPreferences, spectrum, noModPeptide);

        for (IonMatch ionMatch : matches) {
            if (ionMatch.ion.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION) {
                PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ionMatch.ion;
                for (Ion noModIon : fragmentIons.get(ionMatch.charge)) {
                    if (noModIon.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION
                            && peptideFragmentIon.isSameAs(noModIon)) {
                        PeptideFragmentIon noModFragmentIon = (PeptideFragmentIon) noModIon;
                        if (!map.containsKey(noModFragmentIon)) {
                            map.put(noModFragmentIon, new ArrayList<IonMatch>());
                        }
                        map.get(noModFragmentIon).add(ionMatch);
                        break;
                    }
                }
            }
        }
    }

    return map;
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:62,代码来源:PtmtableContent.java

示例4: FragmentAnnotator

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param peptide the peptide
 * @param ionSeries the ion series to annotate
 * @param forward boolean indicating whether forward ions should be
 * annotated
 * @param complementary boolean indicating whether complementary ions should
 * be annotated
 *
 * @throws java.lang.InterruptedException exception thrown if a thread is
 * interrupted
 */
public FragmentAnnotator(Peptide peptide, IonSeries ionSeries, boolean forward, boolean complementary) throws InterruptedException {

    char[] aas = peptide.getSequence().toCharArray();
    peptideLength = aas.length;
    forwardIonMz1 = new double[peptideLength];
    complementaryIonMz1 = new double[peptideLength];

    double[] modificationsMasses = new double[peptideLength];
    ArrayList<ModificationMatch> modificationMatches = peptide.getModificationMatches();
    if (modificationMatches != null) {

        for (ModificationMatch modificationMatch : modificationMatches) {

            String modificationName = modificationMatch.getTheoreticPtm();
            PTM modification = ptmFactory.getPTM(modificationName);
            double modificationMass = modification.getMass();

            int site = modificationMatch.getModificationSite();

            modificationsMasses[site - 1] += modificationMass;
        }
    }

    double forwardMass;
    double complementaryMass;
    if (ionSeries == IonSeries.by) {
        forwardMass = ElementaryIon.proton.getTheoreticMass();
        complementaryMass = peptide.getMass() + ElementaryIon.protonMassMultiples[2];
        forwardIonType = PeptideFragmentIon.B_ION;
        complementaryIonType = PeptideFragmentIon.Y_ION;
    } else if (ionSeries == IonSeries.cz) {
        forwardMass = ElementaryIon.proton.getTheoreticMass() + StandardMasses.nh3.mass;
        complementaryMass = peptide.getMass() + ElementaryIon.protonMassMultiples[2] - StandardMasses.nh3.mass;
        forwardIonType = PeptideFragmentIon.C_ION;
        complementaryIonType = PeptideFragmentIon.Z_ION;
    } else if (ionSeries == IonSeries.ax) {
        forwardMass = ElementaryIon.proton.getTheoreticMass() - StandardMasses.co.mass;
        complementaryMass = peptide.getMass() + ElementaryIon.protonMassMultiples[2] + StandardMasses.co.mass;
        forwardIonType = PeptideFragmentIon.A_ION;
        complementaryIonType = PeptideFragmentIon.X_ION;
    } else {
        throw new UnsupportedOperationException("Ion series " + ionSeries + " not supported.");
    }
    for (int i = 0; i < peptideLength; i++) {

        char aa = aas[i];
        AminoAcid aminoAcid = AminoAcid.getAminoAcid(aa);
        forwardMass += aminoAcid.getMonoisotopicMass();

        forwardMass += modificationsMasses[i];

        if (forward) {
            forwardIonMz1[i] = forwardMass;
        }
        if (complementary) {
            complementaryIonMz1[i] = complementaryMass - forwardMass;
        }
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:73,代码来源:FragmentAnnotator.java

示例5: getAllSpectrumMatches

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
@Override
public LinkedList<SpectrumMatch> getAllSpectrumMatches(WaitingHandler waitingHandler, SearchParameters searchParameters,
        SequenceMatchingPreferences sequenceMatchingPreferences, boolean expandAaCombinations)
        throws IOException, IllegalArgumentException, SQLException, ClassNotFoundException, InterruptedException, JAXBException {

    String mgfFile = Util.removeExtension(fileName) + ".mgf"; //@TODO: make this generic?

    LinkedList<SpectrumMatch> result = new LinkedList<SpectrumMatch>();
    HashMap<String, SpectrumMatch> spectrumMatchesMap = new HashMap<String, SpectrumMatch>();
    BufferedRandomAccessFile bufferedRandomAccessFile = new BufferedRandomAccessFile(resultsFile, "r", 1024 * 100);
    if (waitingHandler != null) {
        waitingHandler.setMaxSecondaryProgressCounter(100);
    }
    long progressUnit = bufferedRandomAccessFile.length() / 100;
    String line, title = null;
    SpectrumMatch spectrumMatch = null;
    int rank = 0;
    boolean firstSpectrum = false;
    while ((line = bufferedRandomAccessFile.readLine()) != null) {
        if (line.startsWith(">")) {
            if (!firstSpectrum) {
                firstSpectrum = true;
            }
            title = line.substring(1);
            // remove any html from the title
            title = URLDecoder.decode(title, "utf-8");
            spectrumMatch = null;
            long currentIndex = bufferedRandomAccessFile.getFilePointer();
            if (waitingHandler != null) {
                waitingHandler.setSecondaryProgressCounter((int) (currentIndex / progressUnit));
            }
        } else if (firstSpectrum) {
            if (spectrumMatch == null) {
                String spectrumKey = Spectrum.getSpectrumKey(mgfFile, title);
                spectrumMatch = spectrumMatchesMap.get(spectrumKey);
                rank = 0; // the rank is here per charge
                if (spectrumMatch == null) {
                    spectrumMatch = new SpectrumMatch(Spectrum.getSpectrumKey(mgfFile, title));
                    result.add(spectrumMatch);
                    spectrumMatchesMap.put(spectrumKey, spectrumMatch);
                }
            }
            rank++;
            PeptideAssumption peptideAssumption = getAssumptionFromLine(line, rank);
            if (expandAaCombinations && AminoAcidSequence.hasCombination(peptideAssumption.getPeptide().getSequence())) {
                Peptide peptide = peptideAssumption.getPeptide();
                ArrayList<ModificationMatch> previousModificationMatches = peptide.getModificationMatches(),
                        newModificationMatches = null;
                if (previousModificationMatches != null) {
                    newModificationMatches = new ArrayList<ModificationMatch>(previousModificationMatches.size());
                }
                for (StringBuilder expandedSequence : AminoAcidSequence.getCombinations(peptide.getSequence())) {
                    Peptide newPeptide = new Peptide(expandedSequence.toString(), newModificationMatches, true);
                    if (previousModificationMatches != null) {
                        for (ModificationMatch modificationMatch : previousModificationMatches) {
                            newPeptide.addModificationMatch(new ModificationMatch(modificationMatch.getTheoreticPtm(), modificationMatch.isVariable(), modificationMatch.getModificationSite()));
                        }
                    }
                    PeptideAssumption newAssumption = new PeptideAssumption(newPeptide, peptideAssumption.getRank(), peptideAssumption.getAdvocate(), peptideAssumption.getIdentificationCharge(), peptideAssumption.getScore(), peptideAssumption.getIdentificationFile());
                    spectrumMatch.addHit(Advocate.andromeda.getIndex(), newAssumption, true);
                }
            } else {
                spectrumMatch.addHit(Advocate.andromeda.getIndex(), peptideAssumption, true);
            }
        }
    }

    return result;
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:70,代码来源:AndromedaIdfileReader.java

示例6: getForwardIonsFeatures

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Returns the ms2pip features for the forward ions of the given peptide at
 * the given charge.
 *
 * @param peptide the peptide
 * @param charge the charge
 * @param ionIndex the ion index
 *
 * @return the ms2pip features for the b ions
 */
public int[] getForwardIonsFeatures(Peptide peptide, int charge, int ionIndex) {

    char[] peptideSequence = peptide.getSequence().toCharArray();
    ArrayList<ModificationMatch> modificationMatches = peptide.getModificationMatches();
    return getIonsFeatures(peptideSequence, modificationMatches, charge, ionIndex);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:17,代码来源:FeaturesGenerator.java


注:本文中的com.compomics.util.experiment.biology.Peptide.getModificationMatches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。