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


Java AASequenceImpl类代码示例

本文整理汇总了Java中com.compomics.util.protein.AASequenceImpl的典型用法代码示例。如果您正苦于以下问题:Java AASequenceImpl类的具体用法?Java AASequenceImpl怎么用?Java AASequenceImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: translate

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method translates the nucleotide sequence in six reading frames.
 *
 * @return  Protein[]   with at most the six reading frames.
 */
public Protein[] translate() {
    // Translate.
    AASequenceImpl[] translated = this.iSequence.translate();

    // Create return array.
    Protein[] result = new Protein[translated.length];

    // Set header.
    for(int i=0;i<translated.length;i++) {
        Header protHeader = (Header)this.getHeader().clone();
        if(protHeader.getAccession() != null) {
            protHeader.setAccession(protHeader.getAccession() + "_(RF " + (i+1) + ")");
        } else {
            protHeader.setRest(protHeader.getRest() + "_(RF " + (i+1) + ")");
        }
        result[i] = new Protein(protHeader, translated[i]);
    }

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

示例2: addAdditionalDataset

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * Adds an additional isotopic distribution dataset to be displayed in the same
 * panel. Remember to use different colors for the different datasets.
 *
 * @param peptideSequence       the peptide sequence to display the isotopic distribution for
 * @param peptideCharge         the charge of the peptide
 * @param dataPointAndLineColor the color to use for the data points and lines
 * @param areaUnderCurveColor   the color to use for the area under the curve
 * @param labelDifference       the number of neutrons to add due to the label
 * @throws IOException if an IOException occurs
 */
public void addAdditionalDataset(String peptideSequence, Integer peptideCharge, Color dataPointAndLineColor, Color areaUnderCurveColor, int labelDifference) throws IOException {

    // validate the peptide sequence
    AASequenceImpl validatedPeptideSequence = validatePeptideSequence(peptideSequence);

    peptideSequences.add(validatedPeptideSequence);
    peptideCharges.add(peptideCharge);

    IsotopicDistributionSpectrum isotopicDistributionSpectrum =
            calculateIsotopicDistribution(validatedPeptideSequence, peptideCharge, labelDifference);

    this.processIsotopicDistribution(isotopicDistributionSpectrum, dataPointAndLineColor, areaUnderCurveColor);

    rescaleWithLeftSidePadding();

    this.showFileName = false;
    this.showPrecursorDetails = false;
    this.showResolution = false;
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:31,代码来源:IsotopicDistributionPanel.java

示例3: validatePeptideSequence

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * Validates the peptide sequence to check for non amino acid elements.
 *
 * @param peptideSequence the peptide sequence to validate
 * @return the validated peptide sequence 
 * @throws IOException
 */
private AASequenceImpl validatePeptideSequence(String peptideSequence) throws IOException {

    // get the sequence
    String lSeq = peptideSequence;

    //exclude unwanted characters
    lSeq = lSeq.trim().toUpperCase();
    lSeq = lSeq.replace("\n", "");
    lSeq = lSeq.replace("\t", "");
    lSeq = lSeq.replace(" ", "");

    // check the amino acids
    for (int i = 0; i < lSeq.length(); i++) {
        String lLetter = String.valueOf(lSeq.charAt(i));
        if (!isElement(lLetter)) {
            throw new IOException(lLetter + " at position " + (i + 1) + " is not a valid element!");
        }
    }
    if (lSeq.length() == 0) {
        throw new IOException("Sequence cannot be of length zero!");
    }

    // return the sequence
    return new AASequenceImpl(lSeq);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:33,代码来源:IsotopicDistributionPanel.java

示例4: testTranslation

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * Test translation of DNA sequence.
 */
public void testTranslation() {
    NucleotideSequenceImpl seq = new NucleotideSequenceImpl("ATG");
    AASequenceImpl[] aas = seq.translate();
    Assert.assertEquals(2, aas.length);
    Assert.assertEquals("M", aas[0].getSequence());

    seq.setSequence("GATTACATTACAGAGAGAGAGGGGATAT");
    aas = seq.translate();
    Assert.assertEquals(6, aas.length);
    Assert.assertEquals("DYITEREGI", aas[0].getSequence());
    Assert.assertEquals("ITLQRERGY", aas[1].getSequence());
    Assert.assertEquals("LHYRERGD", aas[2].getSequence());
    Assert.assertEquals("ISPLSL_CN", aas[3].getSequence());
    Assert.assertEquals("YPLSLCNVI", aas[4].getSequence());
    Assert.assertEquals("IPSLSVM_", aas[5].getSequence());

    // Unknown nucleotide translation into aminoacid X.
    seq.setSequence("GANNACATTACAGAGAGAGAGGGGATAT");
    aas = seq.translate();
    Assert.assertEquals(6, aas.length);
    Assert.assertEquals("XXITEREGI", aas[0].getSequence());
    Assert.assertEquals("XTLQRERGY", aas[1].getSequence());

    Assert.assertEquals(1054.043115, aas[0].getMass(), 1e-10);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:29,代码来源:TestNucleotideSequenceImpl.java

示例5: testTrimmingBehaviour

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test the trimming behaviour of both the constructor
 * and the setSequence method.
 */
public void testTrimmingBehaviour() {
    String sequence1 = "YSFVATAER 	 ";
    String sequence2 = "	 YSFVATAER";
    String sequence3 = "	 YSFVATAER 	 	";
    String sequence = "YSFVATAER";
    Assert.assertEquals(sequence, new AASequenceImpl(sequence1).getSequence());
    Assert.assertEquals(sequence, new AASequenceImpl(sequence2).getSequence());
    Assert.assertEquals(sequence, new AASequenceImpl(sequence3).getSequence());

    Sequence asi1 = new AASequenceImpl(sequence1);
    Sequence asi2 = new AASequenceImpl(sequence2);
    Sequence asi3 = new AASequenceImpl(sequence3);

    Assert.assertEquals(sequence, asi1.getSequence());
    Assert.assertEquals(sequence, asi2.getSequence());
    Assert.assertEquals(sequence, asi3.getSequence());
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:22,代码来源:TestAASequenceImpl.java

示例6: testAddModification

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test adding a modification.
 */
public void testAddModification() {
    AASequenceImpl seq = new AASequenceImpl("LENNARTMARTENS");
    Assert.assertEquals("NH2-LENNARTMARTENS-COOH", seq.getModifiedSequence());
    Assert.assertTrue(seq.getModifications() == null);

    seq.addModification(new ModificationImplementation("Title", "Met", new HashMap(), 15));
    Assert.assertEquals("NH2-LENNARTMARTENS-Met", seq.getModifiedSequence());
    Assert.assertTrue(seq.getModifications() != null);
    Assert.assertEquals(1, seq.getModifications().size());

    seq.addModification(new ModificationImplementation("Nterm", "Ace", new HashMap(), 0));
    seq.addModification(new ModificationImplementation("Mid", "P", new HashMap(), 7));
    Assert.assertEquals("Ace-LENNART<P>MARTENS-Met", seq.getModifiedSequence());
    Assert.assertTrue(seq.getModifications() != null);
    Assert.assertEquals(3, seq.getModifications().size());
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:20,代码来源:TestAASequenceImpl.java

示例7: testGravy

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test the calculation of the Kyte & Doolittle
 * GRAVY coefficient. It also test the caching behaviour.
 */
public void testGravy() {
    AASequenceImpl seq = new AASequenceImpl("LENNART", null);
    Assert.assertEquals(-1.443, seq.getGravy(), Double.MIN_VALUE * 2);
    // Get it from cache. I would be MOST surprised to see this fail,
    // yet one never knows.
    Assert.assertEquals(-1.443, seq.getGravy(), Double.MIN_VALUE * 2);

    seq.setSequence("MARTENS");
    Assert.assertEquals(-1.329, seq.getGravy(), Double.MIN_VALUE * 2);

    seq.setSequence("LENNARTMARTENS");
    Assert.assertEquals(-1.386, seq.getGravy(), Double.MIN_VALUE * 2);

    seq.setSequence("KRISGEVAERT");
    Assert.assertEquals(-1.027, seq.getGravy(), Double.MIN_VALUE * 2);

    seq.setSequence("ARNDCQEGHILKMFPSTWYV");
    Assert.assertEquals(-0.490, seq.getGravy(), Double.MIN_VALUE * 2);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:24,代码来源:TestAASequenceImpl.java

示例8: testMeek

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test the calculation of the Meek HPLC retention
 * time coefficient. It also test the caching behaviour.
 */
public void testMeek() {
    AASequenceImpl seq = new AASequenceImpl("LENNARTMARTENSKRISGEVAERT", null);
    Assert.assertEquals(-0.520, seq.getMeek(), Double.MIN_VALUE * 2);
    // Get it from cache. I would be MOST surprised to see this fail,
    // yet one never knows.
    Assert.assertEquals(-0.520, seq.getMeek(), Double.MIN_VALUE * 2);

    seq.setSequence("LENNARTMARTENSGEVAERT");
    Assert.assertEquals(-0.390, seq.getMeek(), Double.MIN_VALUE * 2);

    seq.setSequence("ARNDCQEGHILKMFPSTWYV");
    Assert.assertEquals(2.52, seq.getMeek(), Double.MIN_VALUE * 2);

    seq.setSequence("ARNDCQEGHILKMFPSTWYVK");
    Assert.assertEquals(2.224, seq.getMeek(), Double.MIN_VALUE * 2);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:21,代码来源:TestAASequenceImpl.java

示例9: main

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * Translate a DNA sequence into 6 reading frames.
 *
 * @param args the DNA sequence to translate
 */
public static void main(String[] args) {
    if(args == null || args.length == 0) {
        logger.error("\n\nUsage:\n\tTranslate <DNA_sequence>");
        System.exit(1);
    }
    // Create a NucleotideSequenceImpl.
    NucleotideSequenceImpl nsi = new NucleotideSequenceImpl(args[0]);
    AASequenceImpl[] seqs = nsi.translate();
    for(int i = 0; i < seqs.length; i++) {
        AASequenceImpl lSeq = seqs[i];
        logger.info(lSeq.getSequence());
    }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:19,代码来源:Translate.java

示例10: IsotopicDistributionPanel

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This constructor creates an IsotopicDistributionPanel based on the passed parameters.
 *
 * @param peptideSequence   the peptide sequence to display the isotopic distribution for
 * @param peptideCharge     the charge of the peptide
 * @param profileMode       if true the peaks will be showed in a profile like mode where
 *                          support peaks are added in front of and after the real peak
 *                          (note that this is unlike the profile modes of the other graphics
 *                          panels)
 * @param labelDifference   the number of neutrons to add due to the label
 * @throws IOException if an IOException occurs
 */
public IsotopicDistributionPanel(String peptideSequence, Integer peptideCharge, boolean profileMode, int labelDifference) throws IOException {

    if (profileMode) {
        this.currentGraphicsPanelType = GraphicsPanelType.isotopicDistributionProfile;
    } else {
        this.currentGraphicsPanelType = GraphicsPanelType.isotopicDistributionCentroid;
    }

    // gets the elements that can be used
    getElements();

    // validate the peptide sequence
    AASequenceImpl validatedPeptideSequence = validatePeptideSequence(peptideSequence);

    peptideSequences = new ArrayList<AASequenceImpl>();
    peptideSequences.add(validatedPeptideSequence);

    peptideCharges = new ArrayList<Integer>();
    peptideCharges.add(peptideCharge);

    // calculate the isotopic distribution
    IsotopicDistributionSpectrum isotopicDistributionSpectrum =
            calculateIsotopicDistribution(validatedPeptideSequence, peptideCharge, labelDifference);

    dataSetCounter = 0;
    this.processIsotopicDistribution(isotopicDistributionSpectrum, aSpectrumPeakColor, aSpectrumProfileModeLineColor);

    // graphical user interface settings
    this.iXAxisStartAtZero = false;
    rescaleWithLeftSidePadding();
    this.iCurrentDrawStyle = DrawingStyle.LINES;
    this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    this.setBackground(Color.WHITE);
    this.iYAxisLabel = "Int (%)";

    this.iSpecPanelListeners = new ArrayList();
    this.addListeners();
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:51,代码来源:IsotopicDistributionPanel.java

示例11: testConstructor

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test the correct behaviour of the constructor
 * and in the same time that of the setSequence method, since
 * it is called from the constructor. <br />
 * It also test the setSequence method separately for safety.
 */
public void testConstructor() {
    String seqString = "YSFVATAER";
    String replaceSeq = "LENNARTMARTENS";
    // Plain constructor.
    AASequenceImpl seq = new AASequenceImpl(seqString);
    Assert.assertEquals(seqString, seq.getSequence());
    Assert.assertTrue(seq.getModifications() == null);
    seq.setSequence(replaceSeq);
    Assert.assertEquals(replaceSeq, seq.getSequence());
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:17,代码来源:TestAASequenceImpl.java

示例12: testIsotopicDistribution

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test the isotopic distribution method.
 */
public void testIsotopicDistribution() {
    String seqString = "YSFVATAER";
    // Plain constructor.
    AASequenceImpl seq = new AASequenceImpl(seqString);
    Assert.assertEquals(71, seq.getMolecularFormula().getElementCount(MolecularElement.H));
    Assert.assertEquals(47, seq.getMolecularFormula().getElementCount(MolecularElement.C));
    Assert.assertEquals(0.10799336006817777, seq.getIsotopicDistribution().getPercTot()[2]);
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:12,代码来源:TestAASequenceImpl.java

示例13: testContains

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test whether the 'contains' method functions correctly.
 */
public void testContains() {
    final String sequence = "LENNARTMARTENS";

    AASequenceImpl seq = new AASequenceImpl(sequence);
    Assert.assertTrue(seq.contains("L"));
    Assert.assertTrue(seq.contains("M"));
    Assert.assertTrue(seq.contains("S"));
    Assert.assertTrue(seq.contains("ENNARTM"));
    Assert.assertTrue(seq.contains("ARTE"));
    Assert.assertFalse(seq.contains("X"));
    Assert.assertFalse(seq.contains("RENNERT"));
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:16,代码来源:TestAASequenceImpl.java

示例14: testCreation

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
 * This method test the creation of a MolecularFormula instance from a peptide that contains selenocysteine amino acid.
 */
public void testCreation() {
    String pepseq="AASULENNAR";
    AASequenceImpl aaSequence = new AASequenceImpl(pepseq);
    MolecularFormula formula = new MolecularFormula(aaSequence);

    Assert.assertEquals("H70 C40 N15 O16 Se1 ", formula.toString());
    Assert.assertEquals(1, formula.getElementCount(MolecularElement.Se));
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:12,代码来源:TestMolecularFormula.java

示例15: calculateIsotopicDistribution

import com.compomics.util.protein.AASequenceImpl; //导入依赖的package包/类
/**
     * Calculates the isotopic distribution of the peptide.
     *
     * @param validatedPeptideSequence  the peptide to calculate the isotopic distribution for
     * @param peptideCharge             the charge of the peptide
     * @param labelDifference           the number of neutrons to add due to the label
     * @return                          the isotopic distribution as a spectrum
     */
    private IsotopicDistributionSpectrum calculateIsotopicDistribution(AASequenceImpl validatedPeptideSequence, Integer peptideCharge, int labedDifference) {

        // calculate the m/z value of the peptide
        double mzValue = validatedPeptideSequence.getMz(peptideCharge);

        // calculate the distribution
        IsotopicDistribution lIso = validatedPeptideSequence.getIsotopicDistribution();

        //set the label difference if necessary
        if(labedDifference>0){
            lIso.setLabelDifference(labedDifference);
        }
        // add the peaks to the dataset
        HashMap lPeaks = new HashMap();

        try {
            for (int i = 0; i < 15; i++) {

//                      @TODO: refine the adding of additional peaks

                int numberOfSidePeaks = 10;

                // if profile mode, add some additional "profile mode looking" peaks before the peak
                if (currentGraphicsPanelType.equals(GraphicsPanelType.isotopicDistributionProfile)) {
                    for (int j=0; j < numberOfSidePeaks; j++) {
                        lPeaks.put(mzValue + (i * (new MassCalc().calculateMass("H") / (double) peptideCharge)) - 0.01*(numberOfSidePeaks-j), lIso.getPercMax()[i] * j*10);
                    }
                }

                lPeaks.put(mzValue + (i * (new MassCalc().calculateMass("H") / (double) peptideCharge)), lIso.getPercMax()[i] * 100);

//                      @TODO: refine the adding of additional peaks

                // if profile mode, add some additional "profile mode looking" peaks before the peak
                if (currentGraphicsPanelType.equals(GraphicsPanelType.isotopicDistributionProfile)) {
                    for (int j=1; j <= numberOfSidePeaks; j++) {
                        lPeaks.put(mzValue + (i * (new MassCalc().calculateMass("H") / (double) peptideCharge)) + 0.01*j, lIso.getPercMax()[i] * (100 - j*10));
                    }
                }
            }
        } catch (UnknownElementMassException ume) {
            logger.error(ume.getMessage(), ume);
        }

        IsotopicDistributionSpectrum lSpecFile = new IsotopicDistributionSpectrum();
        lSpecFile.setCharge(peptideCharge);
        lSpecFile.setPrecursorMZ(mzValue);
        lSpecFile.setPeaks(lPeaks);

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


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