本文整理汇总了Java中com.compomics.util.experiment.biology.ions.ElementaryIon类的典型用法代码示例。如果您正苦于以下问题:Java ElementaryIon类的具体用法?Java ElementaryIon怎么用?Java ElementaryIon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ElementaryIon类属于com.compomics.util.experiment.biology.ions包,在下文中一共展示了ElementaryIon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RemoveFragmentPeakByMassDefect
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public void RemoveFragmentPeakByMassDefect() {
MassDefect MD = new MassDefect();
Logger.getRootLogger().info("Performing mass defect filter on fragment peaks");
Logger.getRootLogger().info("No. of fragment peaks: " + UnSortedPeakCurves.size());
ArrayList<PeakCurve> newlist = new ArrayList<>();
for (PeakCurve peakCurve : UnSortedPeakCurves) {
for (int charge = 1; charge <= 2; charge++) {
float mass = charge * (peakCurve.TargetMz - (float) ElementaryIon.proton.getTheoreticMass());
if (MD.InMassDefectRange(mass, parameter.MassDefectOffset)) {
newlist.add(peakCurve);
break;
}
}
}
UnSortedPeakCurves = newlist;
Logger.getRootLogger().info("No. of remaining fragment peaks: " + UnSortedPeakCurves.size());
}
示例2: IdentifyComplementaryIon
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public void IdentifyComplementaryIon(float totalmass) {
boolean[] fragmentmarked = new boolean[fragments.size()];
Arrays.fill(fragmentmarked, Boolean.FALSE);
for (int i = 0; i < fragments.size(); i++) {
PrecursorFragmentPairEdge fragmentClusterUnit = fragments.get(i);
if (!fragmentmarked[i]) {
fragmentmarked[i] = true;
ArrayList<PrecursorFragmentPairEdge> GroupedFragments = new ArrayList<>();
GroupedFragments.add(fragmentClusterUnit);
float complefrag1 = (float) (totalmass - fragmentClusterUnit.FragmentMz + 2f * ElementaryIon.proton.getTheoreticMass());
if (complefrag1 >= fragmentClusterUnit.FragmentMz) {
for (int j = i + 1; j < fragments.size(); j++) {
if (!fragmentmarked[j]) {
PrecursorFragmentPairEdge fragmentClusterUnit2 = fragments.get(j);
if (InstrumentParameter.CalcPPM(complefrag1, fragmentClusterUnit2.FragmentMz) < parameter.MS2PPM) {
GroupedFragments.add(fragmentClusterUnit2);
fragmentmarked[j] = true;
} else if (fragmentClusterUnit2.FragmentMz > complefrag1) {
break;
}
}
}
}
for (PrecursorFragmentPairEdge fragment : GroupedFragments) {
fragment.ComplementaryFragment = true;
}
}
}
}
示例3: NeutralMass
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public float NeutralMass() {
if (mass == 0f) {
if (MonoIsotopePeak != null) {
mass = Charge * (MonoIsotopePeak.TargetMz - (float) ElementaryIon.proton.getTheoreticMass());
} else {
mass = Charge * (mz[0] - (float) ElementaryIon.proton.getTheoreticMass());
}
}
return mass;
}
示例4: LookUpFragmentMZ
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的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;
}
示例5: getPossibleTags
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
/**
* Computes the possible tag assumptions which can be obtained from this one
* by accounting for other charges and isotopes.
*
* @param forwardIon indicates whether the tag is based on forward ions (a,
* b, or c)
* @param minCharge the minimal precursor charge to consider
* @param maxCharge the maximal precursor charge to consider
* @param maxIsotope the maximal isotope number to consider
*
* @return the possible tag assumptions which can be obtained from this one
* by accounting for other charges and isotopes
*/
public ArrayList<TagAssumption> getPossibleTags(boolean forwardIon, int minCharge, int maxCharge, int maxIsotope) {
ArrayList<TagAssumption> results = new ArrayList<TagAssumption>();
double refMz = getTheoreticMz(true, true);
double refMass = getTheoreticMass();
int refCharge = identificationCharge.value;
for (int charge = minCharge; charge <= maxCharge; charge++) {
for (int isotope = 0; isotope <= maxIsotope; isotope++) {
if (charge != refCharge || isotope > 0) {
double newMass = refMz * charge - charge * ElementaryIon.proton.getTheoreticMass();
double deltaMass = newMass - refMass + isotope * Atom.C.getDifferenceToMonoisotopic(1);
int index = 0;
if (forwardIon) {
index = tag.getContent().size() - 1;
}
TagComponent terminalComponent = tag.getContent().get(index);
if ((terminalComponent instanceof MassGap) && terminalComponent.getMass() > -deltaMass) {
Tag newTag = new Tag(tag);
MassGap terminalGap = (MassGap) newTag.getContent().get(index);
terminalGap.setMass(terminalComponent.getMass() + deltaMass);
TagAssumption tagAssumption = new TagAssumption(advocate, rank, newTag, new Charge(Charge.PLUS, charge), score);
results.add(tagAssumption);
}
}
}
}
return results;
}
示例6: ImmoniumIonAnnotator
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
/**
* Constructor. Warning: there is no check for amino acid uniticy, if
* duplicates are present, they will be reported multiple times.
*
* @param peptideSequence the peptide sequence
* @param immonium boolean indicating whether immonium ions should be
* annotated
* @param related boolean indicating whether related ions should be
* annotated
*/
public ImmoniumIonAnnotator(char[] peptideSequence, boolean immonium, boolean related) {
aas = peptideSequence;
immoniumIonsMz = new double[peptideSequence.length];
relatedIons = new RelatedIon[0];
relatedIonsMz = new double[0];
for (int i = 1; i < aas.length; i++) {
char aa = aas[i];
if (immonium) {
immoniumIonsMz[i] = ImmoniumIon.getImmoniumIon(aa).getTheoreticMass() + ElementaryIon.proton.getTheoreticMass();
}
if (related) {
ArrayList<RelatedIon> aaRelatedIons = RelatedIon.getRelatedIons(aa);
if (aaRelatedIons != null) {
int j = relatedIons.length;
int newLength = j + aaRelatedIons.size();
RelatedIon[] newIons = new RelatedIon[newLength];
double[] newMz = new double[newLength];
System.arraycopy(relatedIons, 0, newIons, 0, relatedIons.length);
System.arraycopy(relatedIonsMz, 0, newMz, 0, relatedIonsMz.length);
for (RelatedIon relatedIon : aaRelatedIons) {
newIons[j] = relatedIon;
newMz[j++] = relatedIon.getTheoreticMass() + ElementaryIon.proton.getTheoreticMass();
}
relatedIons = newIons;
relatedIonsMz = newMz;
}
}
}
}
示例7: ReporterIonAnnotator
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
/**
* Constructor.
*
* @param reporterIons array of the reporter ions to annotate
*/
public ReporterIonAnnotator(ReporterIon[] reporterIons) {
this.reporterIons = reporterIons;
this.reporterIonsMz = new double[reporterIons.length];
for (int i = 0 ; i < reporterIons.length ; i++) {
reporterIonsMz[i] = reporterIons[i].getTheoreticMass() + ElementaryIon.proton.getTheoreticMass();
}
}
示例8: calculateMass
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
/**
* To return (M+H)+ mass from given spectrum
* It is assumed that given spectrum containing only one charge...
* Based on this charge value, (M+H)+ is calculated
*
* @param ms
* @return
*/
public static double calculateMass(MSnSpectrum ms){
double precursor_mz = ms.getPrecursor().getMz();
int chargeValue = ms.getPrecursor().getPossibleCharges().get(0).value;
double multipliedMZ = precursor_mz * chargeValue,
theoProton = ElementaryIon.proton.getTheoreticMass(),
multipliedProton = chargeValue * theoProton,
mass = multipliedMZ - multipliedProton + theoProton;
return mass;
}
示例9: DeisotopingForPeakClusterFragment
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public void DeisotopingForPeakClusterFragment() {
ArrayList<PrecursorFragmentPairEdge> newfragments = new ArrayList<>();
boolean[] fragmentmarked = new boolean[fragments.size()];
Arrays.fill(fragmentmarked, Boolean.TRUE);
PrecursorFragmentPairEdge currentmaxfragment = fragments.get(0);
int currentmaxindex = 0;
for (int i = 1; i < fragments.size(); i++) {
if (InstrumentParameter.CalcPPM(fragments.get(i).FragmentMz, currentmaxfragment.FragmentMz) > parameter.MS2PPM) {
fragmentmarked[currentmaxindex] = false;
currentmaxindex = i;
currentmaxfragment = fragments.get(i);
} else if (fragments.get(i).Intensity > currentmaxfragment.Intensity) {
currentmaxindex = i;
currentmaxfragment = fragments.get(i);
}
}
fragmentmarked[currentmaxindex] = false;
for (int i = 0; i < fragments.size(); i++) {
if (!fragmentmarked[i]) {
fragmentmarked[i] = true;
PrecursorFragmentPairEdge startfrag = fragments.get(i);
boolean groupped = false;
for (int charge = 2; charge >= 1; charge--) {
float lastint = startfrag.Intensity;
boolean found = false;
for (int pkidx = 1; pkidx < 5; pkidx++) {
float targetmz = startfrag.FragmentMz + (float) pkidx / charge;
for (int j = i + 1; j < fragments.size(); j++) {
if (!fragmentmarked[j]) {
PrecursorFragmentPairEdge targetfrag = fragments.get(j);
if (InstrumentParameter.CalcPPM(targetfrag.FragmentMz, targetmz) < parameter.MS2PPM * (pkidx * 0.5 + 1)) {
if (targetfrag.Intensity < lastint) {
fragmentmarked[j] = true;
lastint = targetfrag.Intensity;
found = true;
break;
}
} else if (targetfrag.FragmentMz > targetmz) {
break;
}
}
}
if (!found) {
break;
}
}
if (found) {
groupped = true;
//convert to charge 1 m/z
startfrag.FragmentMz = startfrag.FragmentMz * charge - (charge - 1) * (float) ElementaryIon.proton.getTheoreticMass();
if (startfrag.FragmentMz <= Precursorcluster.NeutralMass()) {
newfragments.add(startfrag);
}
}
}
if (!groupped) {
newfragments.add(startfrag);
}
}
}
fragments = newfragments;
SortFragmentByMZ();
}
示例10: NeutralMass
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public float NeutralMass() {
return Charge * (PrecursorMz() - (float) ElementaryIon.proton.getTheoreticMass());
}
示例11: PrecursorMass
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public float PrecursorMass() {
return PrecursorCharge * (PrecursorMz - (float) ElementaryIon.proton.getTheoreticMass());
}
示例12: GetPeakMz
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public float GetPeakMz(int isotopicpeak) {
return ObservedMz + (isotopicpeak * (float) ElementaryIon.proton.getTheoreticMass() / Charge);
}
示例13: ObservedMass
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public float ObservedMass() {
return Charge * (ObservedMz - (float) ElementaryIon.proton.getTheoreticMass());
}
示例14: NeutralPrecursorMz
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的package包/类
public float NeutralPrecursorMz() {
if (mz == -1f) {
mz = (CalcNeutralPepMass() + Charge * (float) ElementaryIon.proton.getTheoreticMass()) / Charge;
}
return mz;
}
示例15: FragmentAnnotator
import com.compomics.util.experiment.biology.ions.ElementaryIon; //导入依赖的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;
}
}
}