當前位置: 首頁>>代碼示例>>Java>>正文


Java Peptide.isModified方法代碼示例

本文整理匯總了Java中com.compomics.util.experiment.biology.Peptide.isModified方法的典型用法代碼示例。如果您正苦於以下問題:Java Peptide.isModified方法的具體用法?Java Peptide.isModified怎麽用?Java Peptide.isModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.compomics.util.experiment.biology.Peptide的用法示例。


在下文中一共展示了Peptide.isModified方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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


注:本文中的com.compomics.util.experiment.biology.Peptide.isModified方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。