当前位置: 首页>>代码示例>>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;未经允许,请勿转载。