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


Java Peptide.getMass方法代码示例

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


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

示例1: getNextPeptide

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
@Override
public PeptideWithPosition getNextPeptide() throws InterruptedException {
    
    // Get the next sequence
    char[] sequence = ambiguousSequenceIterator.getNextSequence();
    
    // Iteration finished
    if (sequence == null) {
        return null;
    }

    // Create the new peptide
    Peptide peptide = proteinIteratorUtils.getPeptideFromProtein(sequence, 0, massMin, massMax);
    if (peptide != null
            && (massMin == null || peptide.getMass() >= massMin)
            && (massMax == null || peptide.getMass() <= massMax)) {
        return new PeptideWithPosition(peptide, 0);
    } else {
        return getNextPeptide();
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:22,代码来源:NoDigestionCombinationIterator.java

示例2: getDBEntries

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * This method load all sequences in a memory
 *
 * @param databaseName
 * @return
 */
private static HashSet<DBEntry> getDBEntries(String databaseName) throws IOException {
    HashSet<DBEntry> dbEntries = new HashSet<DBEntry>();
    DBLoader loader = DBLoaderLoader.loadDB(new File(databaseName));
    Protein protein = null;
    // get a crossLinkerName object        
    while ((protein = loader.nextProtein()) != null) {
        String sequence = protein.getSequence().getSequence();
        String descrp = protein.getHeader().getDescription(),
                acc = protein.getHeader().getAccession();
        Peptide tmpPep = new Peptide(sequence, new ArrayList<ModificationMatch>());
        double tmpPepMass = tmpPep.getMass();
        DBEntry dbEntry = new DBEntry(tmpPep, descrp, acc, tmpPepMass);
        dbEntries.add(dbEntry);
    }
    return dbEntries;
}
 
开发者ID:compomics,项目名称:spectrum_similarity,代码行数:23,代码来源:AnalyzeTheoreticalMSMSCalculation.java

示例3: getNextPeptide

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
@Override
public PeptideWithPosition getNextPeptide() throws InterruptedException {

    // Increase indices
    if (!increaseIndex()) {
        return null;
    }

    // Get the next sequence
    char[] sequence = Arrays.copyOfRange(proteinSequenceAsCharArray, index1, index2);

    // Construct the peptide
    BoxedObject<Boolean> smallMass = new BoxedObject<Boolean>(Boolean.TRUE);
    Peptide peptide = proteinIteratorUtils.getPeptideFromProtein(sequence, proteinSequence, index1, massMin, massMax, smallMass);

    // Skip too heavy peptides
    if (!smallMass.getObject()) {
        index1++;
        if (index1 == proteinSequenceAsCharArray.length) {
            return null;
        }
        index2 = index1;
    }

    // Return the peptide if it passes the filters, continue iterating otherwise
    if (peptide != null
            && (massMin == null || peptide.getMass() >= massMin)
            && (massMax == null || peptide.getMass() <= massMax)) {
        return new PeptideWithPosition(peptide, index1);
    } else {
        return getNextPeptide();
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:34,代码来源:UnspecificIterator.java

示例4: iterateSequence

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Iterates the sequence to the next missed cleavage and stores the peptides
 * found in the result list.
 *
 * @throws java.lang.InterruptedException exception thrown if a thread is
 * interrupted
 */
private void iterateSequence() throws InterruptedException {

    int initialIndex = sequenceIndex;

    while (++sequenceIndex < proteinSequenceAsCharArray.length) {

        char aaBefore = proteinSequenceAsCharArray[sequenceIndex - 1];
        char aaAfter = proteinSequenceAsCharArray[sequenceIndex];
        if (enzyme.isCleavageSiteNoCombination(aaBefore, aaAfter)) {
            break;
        }
    }

    result.clear();
    char[] newSequence = Arrays.copyOfRange(proteinSequenceAsCharArray, initialIndex, sequenceIndex);
    BoxedObject<Boolean> smallMass = new BoxedObject<Boolean>(Boolean.TRUE);
    Peptide peptide = proteinIteratorUtils.getPeptideFromProtein(newSequence, proteinSequence, initialIndex, massMin, massMax, smallMass);
    if (peptide != null
            && peptide.getMass() >= massMin
            && peptide.getMass() <= massMax) {
        result.add(new PeptideWithPosition(peptide, initialIndex));
    }

    if (nMissedCleavages > 0) {
        if (smallMass.getObject()) {
            HashMap<Integer, Integer> newPeptideStartMap = new HashMap<Integer, Integer>(peptideStartMap.size());
            newPeptideStartMap.put(initialIndex, 0);
            for (int peptideStart : peptideStartMap.keySet()) {
                newSequence = Arrays.copyOfRange(proteinSequenceAsCharArray, peptideStart, sequenceIndex);
                smallMass.setObject(Boolean.TRUE);
                peptide = proteinIteratorUtils.getPeptideFromProtein(newSequence, proteinSequence, peptideStart, massMin, massMax, smallMass);
                if (peptide != null
                        && peptide.getMass() >= massMin
                        && peptide.getMass() <= massMax) {
                    result.add(new PeptideWithPosition(peptide, peptideStart));
                }
                int peptideMissedCleavages = peptideStartMap.get(peptideStart);
                if (smallMass.getObject() && peptideMissedCleavages + 1 < nMissedCleavages) {
                    newPeptideStartMap.put(peptideStart, peptideMissedCleavages + 1);
                }
            }
            peptideStartMap = newPeptideStartMap;
        } else {
            peptideStartMap.clear();
        }
    }
    resultIndex = -1;
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:56,代码来源:SpecificSingleEnzymeIterator.java

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

示例6: setPeptide

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Makes a peptide from the given sequence without digestion and saves it as
 * attribute. The sequence should not contain ambiguous amino acids.
 * Peptides are filtered according to the given masses. Filters are ignored
 * if null.
 *
 * @param sequence the amino acid sequence
 * @param massMin the minimal mass
 * @param massMax the maximal mass
 *
 * @throws java.lang.InterruptedException exception thrown if a thread is
 * interrupted
 */
private void setPeptide(String sequence, double massMin, double massMax) throws InterruptedException {

    Peptide peptide = proteinIteratorUtils.getPeptideFromProtein(sequence.toCharArray(), sequence, 0, massMin, massMax);

    if (peptide != null
            && peptide.getMass() >= massMin
            && peptide.getMass() <= massMax) {
        peptideWithPosition = new PeptideWithPosition(peptide, 0);
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:24,代码来源:NoDigestionIterator.java

示例7: getScore

import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
 * Scores the match between the given peptide and spectrum using the
 * precursor m/z accuracy.
 *
 * @param peptide the peptide of interest
 * @param identificationCharge the charge of the identification
 * @param precursor the precursor of this peptide
 * @param ppm indicates whether the ms1 error is in ppm
 * @param minIsotope the minimal isotope
 * @param maxIsotope the maximal isotope
 *
 * @return the score of the match
 *
 * @throws java.lang.InterruptedException exception thrown if a thread is
 * interrupted
 */
public double getScore(Peptide peptide, int identificationCharge, Precursor precursor, boolean ppm, int minIsotope, int maxIsotope) throws InterruptedException {
    IonMatch ionMatch = new IonMatch(new Peak(precursor.getMz(), 0), new PrecursorIon(peptide.getMass()), identificationCharge);
    return Math.abs(ionMatch.getError(ppm, minIsotope, maxIsotope));
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:21,代码来源:PrecursorAccuracy.java


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