本文整理汇总了Java中com.compomics.util.experiment.biology.Ion类的典型用法代码示例。如果您正苦于以下问题:Java Ion类的具体用法?Java Ion怎么用?Java Ion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Ion类属于com.compomics.util.experiment.biology包,在下文中一共展示了Ion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMatchKey
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Returns the key for the ion match uniquely representing a peak
* annotation. If a cache is given it will be used to store keys, ignored if
* null.
*
* @param ion the ion matched
* @param charge the charge
* @param ionMatchKeysCache a cache for the ion match keys
*
* @return the key for the ion match
*/
public static String getMatchKey(Ion ion, int charge, IonMatchKeysCache ionMatchKeysCache) {
if (ionMatchKeysCache != null) {
return ionMatchKeysCache.getMatchKey(ion, charge);
}
Ion.IonType ionType = ion.getType();
int ionTypeIndex = ionType.index;
int ionSubType = ion.getSubType();
int fragmentIonNumber;
if (ionType == Ion.IonType.PEPTIDE_FRAGMENT_ION) {
PeptideFragmentIon fragmentIon = ((PeptideFragmentIon) ion);
fragmentIonNumber = fragmentIon.getNumber();
} else if (ionType == Ion.IonType.TAG_FRAGMENT_ION) {
TagFragmentIon tagFragmentIon = ((TagFragmentIon) ion);
fragmentIonNumber = tagFragmentIon.getNumber();
} else {
fragmentIonNumber = 0;
}
String neutralLossesAsString = ion.getNeutralLossesAsString();
String key = getMatchKey(ionTypeIndex, ionSubType, fragmentIonNumber, neutralLossesAsString, charge);
return key;
}
示例2: clone
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Clones the settings.
*
* @return a clone of this object
*/
public AnnotationSettings clone() {
AnnotationSettings annotationSettings = new AnnotationSettings();
annotationSettings.setYAxisZoomExcludesBackgroundPeaks(yAxisZoomExcludesBackgroundPeaks);
annotationSettings.setShowAllPeaks(showAllPeaks);
annotationSettings.setIntensityLimit(intensityLimit);
annotationSettings.setAutomaticAnnotation(automaticAnnotation);
annotationSettings.setFragmentIonAccuracy(fragmentIonAccuracy);
annotationSettings.setFragmentIonPpm(fragmentIonPpm);
annotationSettings.setShowForwardIonDeNovoTags(showForwardIonDeNovoTags);
annotationSettings.setShowRewindIonDeNovoTags(showRewindIonDeNovoTags);
annotationSettings.setDeNovoCharge(deNovoCharge);
annotationSettings.setTiesResolution(getTiesResolution());
annotationSettings.setNeutralLossesSequenceAuto(neutralLossesAuto);
annotationSettings.setReporterIons(getReporterIons());
annotationSettings.setReporterIons(getRelatedIons());
for (NeutralLoss neutralLoss : neutralLossesList) {
annotationSettings.addNeutralLoss(neutralLoss);
}
for (Ion.IonType ionType : selectedIonsMap.keySet()) {
for (Integer subType : selectedIonsMap.get(ionType)) {
annotationSettings.addIonType(ionType, subType);
}
}
return annotationSettings;
}
示例3: setPeptide
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Sets a new peptide to match.
*
* @param peptide the new peptide
* @param possibleFragmentIons the possible fragment ions of the peptide
* @param precursorCharge the new precursor charge
* @param specificAnnotationSettings if provided, only the ions detectable
* using these settings will be selected
*/
public void setPeptide(Peptide peptide, HashMap<Integer, HashMap<Integer, ArrayList<Ion>>> possibleFragmentIons, int precursorCharge, SpecificAnnotationSettings specificAnnotationSettings) {
if (specificAnnotationSettings != null && super.specificAnnotationSettings == null
|| specificAnnotationSettings == null && super.specificAnnotationSettings != null
|| specificAnnotationSettings != null && super.specificAnnotationSettings != null && specificAnnotationSettings != super.specificAnnotationSettings
|| this.peptide == null
|| !this.peptide.getKey().equals(peptide.getKey())
|| !this.peptide.sameModificationsAs(peptide)
|| this.precursorCharge != precursorCharge) {
// Set new values
this.peptide = peptide;
this.precursorCharge = precursorCharge;
if (possibleFragmentIons == null) {
theoreticalFragmentIons = fragmentFactory.getFragmentIons(peptide, specificAnnotationSettings);
} else {
theoreticalFragmentIons = possibleFragmentIons;
}
if (massShift != 0 || massShiftNTerm != 0 || massShiftCTerm != 0) {
updateMassShifts();
}
}
}
示例4: matchInSpectrum
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Matches a theoretic ion in the spectrum. Returns an IonMatch containing
* the ion and the peak. Null if not found.
*
* @param theoreticIon the theoretic ion
* @param inspectedCharge the expected charge
*
* @return the IonMatch between the ion and the peak
*/
protected IonMatch matchInSpectrum(Ion theoreticIon, Integer inspectedCharge) {
double fragmentMz = theoreticIon.getTheoreticMz(inspectedCharge);
// Get the peaks matching the desired m/z
ArrayList<Peak> matchedPeaks = spectrumIndex.getMatchingPeaks(fragmentMz);
if (matchedPeaks.isEmpty()) {
return null;
}
// Select the most accurate or most intense according to the annotation settings
IonMatch ionMatch = new IonMatch(null, theoreticIon, inspectedCharge);
ionMatch.peak = (matchedPeaks.size() == 1) ? matchedPeaks.get(0) : getBestPeak(matchedPeaks, ionMatch);
return ionMatch;
}
示例5: chargeValidated
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Returns a boolean indicating whether the given charge can be found on the
* given fragment ion.
*
* @param theoreticIon the ion of interest
* @param charge the candidate charge
* @param precursorCharge the precursor charge
*
* @return a boolean indicating whether the given charge can be found on the
* given fragment ion
*/
public boolean chargeValidated(Ion theoreticIon, int charge, int precursorCharge) {
if (charge == 1) {
return true;
}
switch (theoreticIon.getType()) {
case IMMONIUM_ION:
case RELATED_ION: // note: it is possible to implement higher charges but then modify IonMatch.getPeakAnnotation(boolean html) as well to see the charge displayed on the spectrum
return false;
case REPORTER_ION: // note: it is possible to implement higher charges but then modify IonMatch.getPeakAnnotation(boolean html) as well to see the charge displayed on the spectrum
return false;
case PEPTIDE_FRAGMENT_ION:
PeptideFragmentIon peptideFragmentIon = ((PeptideFragmentIon) theoreticIon);
return charge <= peptideFragmentIon.getNumber() && charge < precursorCharge;
case TAG_FRAGMENT_ION:
TagFragmentIon tagFragmentIon = ((TagFragmentIon) theoreticIon);
return charge <= tagFragmentIon.getNumber() && charge < precursorCharge;
case PRECURSOR_ION:
return charge >= precursorCharge;
default:
throw new UnsupportedOperationException("Ion type " + theoreticIon.getTypeAsString() + " not implemented in the spectrum annotator.");
}
}
示例6: Identify
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
*
* @param ms an MSnSpectrum object to compared
* @param peptide a selected peptide entry from db within given precursor
* tolerance
* @param fragment_tolerance
* @param isSequestLikeScore true:SEQUEST-like score, false:Andromeda-like
* score
* @param isCorrectMatch true:correct match if either target/UPS,
* false:incorrect match if either decoy/Pfu
* @param totalScoredPeps total number of peptides matched to a given ms
* @param correctionFactor correction factor value for SEQUEST-like scoring
* (to compute Xcorr)
* @param hasAllPossCharge true: ions with all possible charges, false: only
* up to doubly charged ions
*/
public Identify(MSnSpectrum ms, Peptide peptide, double fragment_tolerance, boolean isSequestLikeScore, boolean isCorrectMatch, int totalScoredPeps, int correctionFactor, boolean hasAllPossCharge) {
this.isSequestLikeScore = isSequestLikeScore;
this.fragment_tolerance = fragment_tolerance;
this.isCorrectMatch = isCorrectMatch;
spectrum = ms;
this.peptide = peptide;
// get theoretical ions..
HashMap<Integer, ArrayList<Ion>> product_ions_peptideA = fragmentFactory.getFragmentIons(peptide).get(0);
// add all b- ions and y-ions with uniform intensity of 50
theoretical_ions = product_ions_peptideA.get(PeptideFragmentIon.Y_ION);
theoretical_ions.addAll(product_ions_peptideA.get(PeptideFragmentIon.B_ION));
int prec = spectrum.getPrecursor().getPossibleCharges().get(0).value;
if (hasAllPossCharge) {
generate_theoretical_ions(prec);
} else if (!hasAllPossCharge && prec >= 2) {
generate_theoretical_ions(2);
} else {
generate_theoretical_ions(1);
}
this.totalScoredPeps = totalScoredPeps;
this.correctionFactor = correctionFactor;
score = match_and_score();
}
示例7: LookUpFragmentMZ
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
public float LookUpFragmentMZ(PeptideFragmentIon.IonType fragmentIonType, int num) {
for (Ion frag : GetFragments()) {
if (frag.getType() == fragmentIonType && "".equals(frag.getNeutralLossesAsString()) && ((PeptideFragmentIon) frag).getNumber() == num) {
return (float) (frag.getTheoreticMass() + ElementaryIon.proton.getTheoreticMass());
}
}
return 0f;
}
示例8: SetFragments
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
private void SetFragments() {
peptide = GetPepFactory();
HashMap<Integer, HashMap<Integer, ArrayList<Ion>>> allfragment = IonFactory.getInstance().getFragmentIons(peptide);
Fragments = new ArrayList<>();
Fragments.addAll(allfragment.get(Ion.IonType.PEPTIDE_FRAGMENT_ION.index).get(PeptideFragmentIon.B_ION));
Fragments.addAll(allfragment.get(Ion.IonType.PEPTIDE_FRAGMENT_ION.index).get(PeptideFragmentIon.Y_ION));
}
示例9: getCurrentFragmentIonTypes
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Returns a map of the currently selected fragment ion types.
*
* @return a map of the currently selected fragment ion types
*/
private HashMap<IonType, ArrayList<Integer>> getCurrentFragmentIonTypes() {
HashMap<IonType, ArrayList<Integer>> fragmentIontypes = new HashMap<IonType, ArrayList<Integer>>();
fragmentIontypes.put(IonType.PEPTIDE_FRAGMENT_ION, new ArrayList<Integer>());
if (aIonsJCheckBox.isSelected()) {
fragmentIontypes.get(IonType.PEPTIDE_FRAGMENT_ION).add(PeptideFragmentIon.A_ION);
}
if (bIonsJCheckBox.isSelected()) {
fragmentIontypes.get(IonType.PEPTIDE_FRAGMENT_ION).add(PeptideFragmentIon.B_ION);
}
if (cIonsJCheckBox.isSelected()) {
fragmentIontypes.get(IonType.PEPTIDE_FRAGMENT_ION).add(PeptideFragmentIon.C_ION);
}
if (xIonsJCheckBox.isSelected()) {
fragmentIontypes.get(IonType.PEPTIDE_FRAGMENT_ION).add(PeptideFragmentIon.X_ION);
}
if (yIonsJCheckBox.isSelected()) {
fragmentIontypes.get(IonType.PEPTIDE_FRAGMENT_ION).add(PeptideFragmentIon.Y_ION);
}
if (zIonsJCheckBox.isSelected()) {
fragmentIontypes.get(IonType.PEPTIDE_FRAGMENT_ION).add(PeptideFragmentIon.Z_ION);
}
if (otherIonsJCheckBox.isSelected()) {
fragmentIontypes.put(IonType.IMMONIUM_ION, Ion.getPossibleSubtypes(IonType.IMMONIUM_ION));
fragmentIontypes.put(IonType.PRECURSOR_ION, Ion.getPossibleSubtypes(IonType.PRECURSOR_ION));
fragmentIontypes.put(IonType.REPORTER_ION, Ion.getPossibleSubtypes(IonType.REPORTER_ION));
}
return fragmentIontypes;
}
示例10: isSameAs
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
@Override
public boolean isSameAs(Ion anotherIon) {
if (anotherIon instanceof ReporterIon) {
ReporterIon otherIon = (ReporterIon) anotherIon;
return isSameAs(otherIon);
}
return false;
}
示例11: isSameAs
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
@Override
public boolean isSameAs(Ion anotherIon) {
return anotherIon.getType() == Ion.IonType.TAG_FRAGMENT_ION
&& anotherIon.getSubType() == subType
&& ((PeptideFragmentIon) anotherIon).getNumber() == number
&& anotherIon.getNeutralLossesAsString().equals(getNeutralLossesAsString());
}
示例12: isSameAs
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
@Override
public boolean isSameAs(Ion anotherIon) {
if (anotherIon instanceof RelatedIon) {
RelatedIon otherIon = (RelatedIon) anotherIon;
return isSameAs(otherIon);
}
return false;
}
示例13: isSameAs
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
@Override
public boolean isSameAs(Ion anotherIon) {
return anotherIon.getType() == IonType.ELEMENTARY_ION
&& anotherIon.getSubType() == subType
&& anotherIon.getTheoreticMass() == theoreticMass1
&& anotherIon.getNeutralLossesAsString().equals(getNeutralLossesAsString());
}
示例14: isSameAs
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
@Override
public boolean isSameAs(Ion anotherIon) {
return anotherIon.getType() == IonType.PEPTIDE_FRAGMENT_ION
&& anotherIon.getSubType() == subType
&& ((PeptideFragmentIon) anotherIon).getNumber() == number
&& anotherIon.getNeutralLossesAsString().equals(getNeutralLossesAsString());
}
示例15: getScore
import com.compomics.util.experiment.biology.Ion; //导入依赖的package包/类
/**
* Scores the match between the given peptide and spectrum using the
* complementarity of the matched peaks. For every residue, a list of
* matched peaks is established and if any is found, the score per residue
* is the log of the number of matched ions. The peptide score is the
* average of the residue scores.
*
* @param peptide the peptide of interest
* @param spectrum the spectrum of interest
* @param annotationPreferences the general spectrum annotation preferences
* @param specificAnnotationPreferences the annotation preferences specific to this psm
* @param peptideSpectrumAnnotator the spectrum annotator to use
*
* @return the score of the match
*
* @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 double getScore(Peptide peptide, MSnSpectrum spectrum, AnnotationSettings annotationPreferences, SpecificAnnotationSettings specificAnnotationPreferences, PeptideSpectrumAnnotator peptideSpectrumAnnotator) throws InterruptedException, MathException {
int sequenceLength = peptide.getSequence().length();
ArrayList<IonMatch> matches = peptideSpectrumAnnotator.getSpectrumAnnotation(annotationPreferences, specificAnnotationPreferences,
spectrum, peptide);
HashMap<Integer, Double> residueToMatchesMap = new HashMap<Integer, Double>(sequenceLength);
for (int i = 1; i <= sequenceLength; i++) {
residueToMatchesMap.put(i, 0.0);
}
for (IonMatch ionMatch : matches) {
Ion ion = ionMatch.ion;
if (ion instanceof PeptideFragmentIon) {
PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
int number = peptideFragmentIon.getNumber();
residueToMatchesMap.put(number, residueToMatchesMap.get(number) + 1);
}
}
ArrayList<Double> scorePerResidue = new ArrayList<Double>(residueToMatchesMap.size());
for (int number = 1; number <= sequenceLength; number++) {
Double nIons = residueToMatchesMap.get(number);
if (nIons != null) {
scorePerResidue.add(FastMath.log(nIons) / log2);
}
}
double mean = 0;
if (!scorePerResidue.isEmpty()) {
mean = BasicMathFunctions.mean(scorePerResidue);
}
return Math.pow(2, mean);
}