本文整理匯總了Java中com.compomics.util.experiment.biology.Ion.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java Ion.getType方法的具體用法?Java Ion.getType怎麽用?Java Ion.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.compomics.util.experiment.biology.Ion
的用法示例。
在下文中一共展示了Ion.getType方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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.");
}
}
示例3: 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;
}
示例4: 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());
}
示例5: 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());
}
示例6: 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());
}
示例7: getCoveredAminoAcids
import com.compomics.util.experiment.biology.Ion; //導入方法依賴的package包/類
/**
* Returns the ion matches corresponding to fragment ions indexed by amino
* acid number in the sequence. 1 is first amino acid.
*
* @param annotationSettings the annotation settings
* @param specificAnnotationSettings the specific annotation settings
* @param spectrum The spectrum to match
* @param peptide The peptide of interest
* @param useIntensityFilter boolean indicating whether intensity filters
* should be used
*
* @return the ion matches corresponding to fragment ions indexed by amino
* acid number in the sequence
*
* @throws java.lang.InterruptedException exception thrown if a threading
* error occurred when estimating the noise level
* @throws org.apache.commons.math.MathException exception thrown if a math
* exception occurred when estimating the noise level
*/
public HashMap<Integer, ArrayList<IonMatch>> getCoveredAminoAcids(AnnotationSettings annotationSettings,
SpecificAnnotationSettings specificAnnotationSettings, MSnSpectrum spectrum, Peptide peptide, boolean useIntensityFilter) throws InterruptedException, MathException {
HashMap<Integer, ArrayList<IonMatch>> matchesMap = new HashMap<Integer, ArrayList<IonMatch>>();
ArrayList<IonMatch> matches = getSpectrumAnnotation(annotationSettings, specificAnnotationSettings, spectrum, peptide, useIntensityFilter);
for (IonMatch ionMatch : matches) {
Ion ion = ionMatch.ion;
int number;
if (ion.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION) {
if (ion.getSubType() == PeptideFragmentIon.A_ION
|| ion.getSubType() == PeptideFragmentIon.B_ION
|| ion.getSubType() == PeptideFragmentIon.C_ION) {
number = ((PeptideFragmentIon) ion).getNumber();
} else {
number = peptide.getSequence().length() + 1 - ((PeptideFragmentIon) ion).getNumber();
}
if (!matchesMap.containsKey(number)) {
matchesMap.put(number, new ArrayList<IonMatch>());
}
matchesMap.get(number).add(ionMatch);
}
}
return matchesMap;
}
示例8: isSameAs
import com.compomics.util.experiment.biology.Ion; //導入方法依賴的package包/類
@Override
public boolean isSameAs(Ion anotherIon) {
return anotherIon.getType() == IonType.PRECURSOR_ION
&& anotherIon.getNeutralLossesAsString().equals(getNeutralLossesAsString());
}
示例9: isSameAs
import com.compomics.util.experiment.biology.Ion; //導入方法依賴的package包/類
@Override
public boolean isSameAs(Ion anotherIon) {
return anotherIon.getType() == IonType.IMMONIUM_ION
&& anotherIon.getSubType() == subType;
}
示例10: getPTMPlotData
import com.compomics.util.experiment.biology.Ion; //導入方法依賴的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;
}
示例11: isAccounted
import com.compomics.util.experiment.biology.Ion; //導入方法依賴的package包/類
/**
* Returns a boolean indicating whether the neutral loss should be accounted
* for.
*
* @param neutralLosses map of expected neutral losses
* @param neutralLoss the neutral loss of interest
* @param ion the fragment ion of interest
*
* @return boolean indicating whether the neutral loss should be considered
*/
public boolean isAccounted(NeutralLossesMap neutralLosses, NeutralLoss neutralLoss, Ion ion) {
if (neutralLosses == null || neutralLosses.isEmpty()) {
return false;
}
for (String neutralLossName : neutralLosses.getAccountedNeutralLosses()) {
NeutralLoss neutralLossRef = NeutralLoss.getNeutralLoss(neutralLossName);
if (neutralLoss.isSameAs(neutralLossRef)) {
switch (ion.getType()) {
case PEPTIDE_FRAGMENT_ION:
PeptideFragmentIon peptideFragmentIon = ((PeptideFragmentIon) ion);
switch (ion.getSubType()) {
case PeptideFragmentIon.A_ION:
case PeptideFragmentIon.B_ION:
case PeptideFragmentIon.C_ION:
return neutralLosses.getForwardStart(neutralLossName) <= peptideFragmentIon.getNumber();
case PeptideFragmentIon.X_ION:
case PeptideFragmentIon.Y_ION:
case PeptideFragmentIon.Z_ION:
return neutralLosses.getRewindStart(neutralLossName) <= peptideFragmentIon.getNumber();
default:
throw new UnsupportedOperationException("Fragment ion type " + ion.getSubTypeAsString() + " not implemented in the spectrum annotator.");
}
case TAG_FRAGMENT_ION:
TagFragmentIon tagFragmentIon = ((TagFragmentIon) ion);
switch (ion.getSubType()) {
case TagFragmentIon.A_ION:
case TagFragmentIon.B_ION:
case TagFragmentIon.C_ION:
return neutralLosses.getForwardStart(neutralLossName) <= tagFragmentIon.getNumber();
case TagFragmentIon.X_ION:
case TagFragmentIon.Y_ION:
case TagFragmentIon.Z_ION:
return neutralLosses.getRewindStart(neutralLossName) <= tagFragmentIon.getNumber();
default:
throw new UnsupportedOperationException("Fragment ion type " + ion.getSubTypeAsString() + " not implemented in the spectrum annotator.");
}
default:
return true;
}
}
}
return false;
}
示例12: getMatchKey
import com.compomics.util.experiment.biology.Ion; //導入方法依賴的package包/類
/**
* Returns the key for the ion match uniquely representing a peak
* annotation.
*
* @param ion the ion matched
* @param charge the charge
*
* @return the key for the ion match
*/
public String getMatchKey(Ion ion, int 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();
HashMap<Integer, HashMap<Integer, HashMap<String, HashMap<Integer, String>>>> ionTypeMap = ionKeysCache.get(ionTypeIndex);
if (ionTypeMap == null) {
ionTypeMap = new HashMap<Integer, HashMap<Integer, HashMap<String, HashMap<Integer, String>>>>(8);
ionKeysCache.put(ionTypeIndex, ionTypeMap);
}
HashMap<Integer, HashMap<String, HashMap<Integer, String>>> ionSubTypeMap = ionTypeMap.get(ionSubType);
if (ionSubTypeMap == null) {
ionSubTypeMap = new HashMap<Integer, HashMap<String, HashMap<Integer, String>>>(2);
ionTypeMap.put(ionSubType, ionSubTypeMap);
}
HashMap<String, HashMap<Integer, String>> ionNumberMap = ionSubTypeMap.get(fragmentIonNumber);
if (ionNumberMap == null) {
ionNumberMap = new HashMap<String, HashMap<Integer, String>>(8);
ionSubTypeMap.put(fragmentIonNumber, ionNumberMap);
}
HashMap<Integer, String> ionNeutralLossesMap = ionNumberMap.get(neutralLossesAsString);
if (ionNeutralLossesMap == null) {
ionNeutralLossesMap = new HashMap<Integer, String>(4);
ionNumberMap.put(neutralLossesAsString, ionNeutralLossesMap);
}
String key = ionNeutralLossesMap.get(charge);
if (key == null) {
key = IonMatch.getMatchKey(ionTypeIndex, ionSubType, fragmentIonNumber, neutralLossesAsString, charge);
ionNeutralLossesMap.put(charge, key);
}
return key;
}