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


Java SpectrumPanel类代码示例

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


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

示例1: getSpectrumPanel

import com.compomics.util.gui.spectrum.SpectrumPanel; //导入依赖的package包/类
/**
 * Returns a spectrum panel containing the provided data.
 *
 * @param pklFile the pkl file containing the spectrum
 * @param profileMode if true the spectrum is drawn in profile mode
 * @return the created spectrum panel
 * @throws IOException
 */
private SpectrumPanel getSpectrumPanel(PklFile pklFile, boolean profileMode) throws IOException {

    SpectrumPanel spectrumPanel = new SpectrumPanel(
            pklFile.getMzValues(), pklFile.getIntensityValues(),
            pklFile.getPrecursorMz(), "" + pklFile.getPrecurorCharge(),
            "" + pklFile.getFileName(),
            spectrumPanelMaxPadding, false, false, false, 2, profileMode);

    spectrumPanel.addSpectrumPanelListener(new SpectrumPanelListener() {
        public void rescaled(RescalingEvent rescalingEvent) {
            SpectrumPanel source = (SpectrumPanel) rescalingEvent.getSource();
            double minMass = rescalingEvent.getMinMass();
            double maxMass = rescalingEvent.getMaxMass();

            Iterator<Integer> iterator = linkedSpectrumPanels.keySet().iterator();

            while (iterator.hasNext()) {
                SpectrumPanel currentSpectrumPanel = linkedSpectrumPanels.get(iterator.next());
                if (currentSpectrumPanel != source && linkedSpectraJCheckBox.isSelected()) {
                    currentSpectrumPanel.rescale(minMass, maxMass, false);
                    currentSpectrumPanel.repaint();
                }
            }
        }
    });

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

示例2: aIonsJCheckBoxActionPerformed

import com.compomics.util.gui.spectrum.SpectrumPanel; //导入依赖的package包/类
/**
     * Updates the ion coverage annotations.
     *
     * @param evt
     */
    private void aIonsJCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aIonsJCheckBoxActionPerformed

        Iterator<Integer> iterator = linkedSpectrumPanels.keySet().iterator();

        while (iterator.hasNext()) {

            Integer key = iterator.next();
            SpectrumPanel currentSpectrumPanel = linkedSpectrumPanels.get(key);
            Vector<SpectrumAnnotation> currentAnnotations = allAnnotations.get(key);

            // update the ion coverage annotations
            currentSpectrumPanel.setAnnotations(SpectrumPanel.filterAnnotations(
                    currentAnnotations,
                    getCurrentFragmentIonTypes(),
                    getNeutralLosses(),
                    chargeOneJCheckBox.isSelected(),
                    chargeTwoJCheckBox.isSelected(),
                    chargeOverTwoJCheckBox.isSelected()));
            currentSpectrumPanel.validate();
            currentSpectrumPanel.repaint();
        }
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:28,代码来源:UtilitiesDemo.java

示例3: getSpectrumAnnotation

import com.compomics.util.gui.spectrum.SpectrumPanel; //导入依赖的package包/类
/**
 * Translates the list of ion matches into a vector of annotations which can
 * be read by the SpectrumPanel.
 *
 * @param ionMatches list of ion matches
 *
 * @return vector of default spectrum annotations
 */
public static Vector<SpectrumAnnotation> getSpectrumAnnotation(ArrayList<IonMatch> ionMatches) {
    Vector<SpectrumAnnotation> currentAnnotations = new Vector();
    for (IonMatch ionMatch : ionMatches) {
        currentAnnotations.add(new DefaultSpectrumAnnotation(ionMatch.peak.mz, ionMatch.getAbsoluteError(minIsotopicCorrection, maxIsotopicCorrection),
                SpectrumPanel.determineFragmentIonColor(ionMatch.ion, true), ionMatch.getPeakAnnotation()));
    }
    return currentAnnotations;
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:17,代码来源:SpectrumAnnotator.java

示例4: plotMirroredSpectra

import com.compomics.util.gui.spectrum.SpectrumPanel; //导入依赖的package包/类
private void plotMirroredSpectra(MSnSpectrum spectrum_A, MSnSpectrum spectrum_B) {
    double[] specA_intensity = spectrum_A.getIntensityValuesAsArray(),
            specA_mz = spectrum_A.getMzValuesAsArray(),
            specB_intensity = spectrum_B.getIntensityValuesAsArray(),
            specB_mz = spectrum_B.getMzValuesAsArray();
    double specA_precursor_mz = spectrum_A.getPrecursor().getMz(),
            specA_precursor_charge = spectrum_A.getPrecursor().getPossibleCharges().get(0).value,
            specB_precursor_mz = spectrum_B.getPrecursor().getMz(),
            specB_precursor_charge = spectrum_B.getPrecursor().getPossibleCharges().get(0).value;
    String specA_fileName = spectrum_A.getFileName(),
            specB_fileName = spectrum_B.getFileName();

    spectrumPanel = new SpectrumPanel(
            specA_mz, specA_intensity,
            specA_precursor_mz, "" + specA_precursor_charge,
            "" + specA_fileName,
            50, false, false, false, 2, false);

    // spectrumPanel.setaSpectrumPeakColor(Color.BLUE);
    spectrumPanel.addMirroredSpectrum(
            specB_mz, specB_intensity,
            specB_precursor_mz, "" + specB_precursor_charge,
            "" + specB_fileName,
            false, Color.BLUE, Color.BLUE);

    spectrumPanel.setBackground(Color.getHSBColor(10, 0, 8));

    spectrumjPanel.remove(chartPanel);
    spectrumjPanel.removeAll();
    spectrumjPanel.repaint();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    spectrumjPanel.add(spectrumPanel, gridBagConstraints);
    spectrumjPanel.revalidate();
    spectrumjPanel.repaint();
}
 
开发者ID:compomics,项目名称:spectrum_similarity,代码行数:39,代码来源:MainGUI.java

示例5: calculate

import com.compomics.util.gui.spectrum.SpectrumPanel; //导入依赖的package包/类
/**
 * This method will do the calculations
 */
public void calculate() {
    //Get the sequence
    String lSeq = txtSequence.getText();
    //exclude unwanted characters
    lSeq = lSeq.trim().toUpperCase();
    lSeq = lSeq.replace("\n", "");
    lSeq = lSeq.replace("\t", "");
    lSeq = lSeq.replace(" ", "");
    //check the aminoacids
    for (int i = 0; i < lSeq.length(); i++) {
        String lLetter = String.valueOf(lSeq.charAt(i));
        if (!isElement(lLetter)) {
            //return
            JOptionPane.showMessageDialog(this, lLetter + " at position " + (i + 1) + " is not a valid element", "Not valid element", JOptionPane.ERROR_MESSAGE);
            return;
        }
    }
    if (lSeq.length() == 0) {
        //return
        JOptionPane.showMessageDialog(this, "Sequence cannot be of length zero!", "Not valid sequence", JOptionPane.ERROR_MESSAGE);
        return;
    }
    //create the sequence
    iSequence = new AASequenceImpl(lSeq);
    //get the charge
    iCharge = (Double) spinCharge.getValue();
    //set the labels
    lblComp.setText(iSequence.getMolecularFormula().toString());
    double lMz = iSequence.getMz((int) iCharge);
    lblMass.setText(String.valueOf(Math.floor(lMz * 10000.0) / 10000.0) + " Da");
    lblPeptide.setText("NH2-" + lSeq + "-COOH (" + iCharge + "+)");
    //calculate the distribution
    IsotopicDistribution lIso = iSequence.getIsotopicDistribution();
    HashMap lPeaks = new HashMap();
    //add the data to the table
    for (int i = 0; i < 10; i++) {
        table1.setValueAt(i, i, 0);
        table1.setValueAt(Math.floor(lIso.getPercTot()[i] * 10000.0) / 100.0, i, 1);
        table1.setValueAt(Math.floor(lIso.getPercMax()[i] * 10000.0) / 100.0, i, 2);
        try {
            lPeaks.put(lMz + (i * (new MassCalc().calculateMass("H") / iCharge)), lIso.getPercMax()[i]);
        } catch (UnknownElementMassException ume) {
            logger.error(ume.getMessage(), ume);
        }
    }
    //do gui updates an add the spectrum panel
    table1.updateUI();
    IsotopicDistributionSpectrum lSpecFile = new IsotopicDistributionSpectrum();
    lSpecFile.setCharge(Integer.valueOf(String.valueOf(iCharge).substring(0, String.valueOf(iCharge).indexOf("."))));
    lSpecFile.setPrecursorMZ(lMz);
    lSpecFile.setPeaks(lPeaks);
    spectrumPanel.removeAll();
    SpectrumPanel lSpecPanel = new SpectrumPanel(lSpecFile, false);
    lSpecPanel.rescale(lMz - (0.5 / iCharge), lMz + (0.5 / iCharge) + (10.0 / iCharge));
    spectrumPanel.add(lSpecPanel);
    spectrumPanel.updateUI();
}
 
开发者ID:compomics,项目名称:compomics-utilities,代码行数:61,代码来源:IsotopeDistributionGui.java


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