本文整理汇总了Java中com.compomics.util.experiment.biology.Peptide.addModificationMatch方法的典型用法代码示例。如果您正苦于以下问题:Java Peptide.addModificationMatch方法的具体用法?Java Peptide.addModificationMatch怎么用?Java Peptide.addModificationMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.compomics.util.experiment.biology.Peptide
的用法示例。
在下文中一共展示了Peptide.addModificationMatch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPossiblePeptidesMap
import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
* Returns a map of the different possible peptides for the different
* profiles.
*
* @param peptide the peptide of interest
* @param ptms the PTMs to score
* @param possibleProfiles the different profiles
*
* @return a map of the different peptides for the different profiles
*
* @throws IOException exception thrown whenever an error occurred while
* reading a protein sequence
* @throws InterruptedException exception thrown whenever an error occurred
* while reading a protein sequence
* @throws ClassNotFoundException if a ClassNotFoundException occurs
* @throws SQLException if an SQLException occurs
*/
private static HashMap<String, Peptide> getPossiblePeptidesMap(Peptide peptide, ArrayList<PTM> ptms, ArrayList<ArrayList<Integer>> possibleProfiles) throws IOException, SQLException, ClassNotFoundException, InterruptedException {
String representativePTM = ptms.get(0).getName();
HashMap<String, Peptide> result = new HashMap<String, Peptide>(possibleProfiles.size());
int peptideLength = peptide.getSequence().length();
for (ArrayList<Integer> profile : possibleProfiles) {
Peptide tempPeptide = Peptide.getNoModPeptide(peptide, ptms);
for (int pos : profile) {
int index = pos;
if (index == 0) {
index = 1;
} else if (index == peptideLength + 1) {
index = peptideLength;
}
tempPeptide.addModificationMatch(new ModificationMatch(representativePTM, true, index));
}
String profileKey = KeyUtils.getKey(profile);
result.put(profileKey, tempPeptide);
}
return result;
}
示例2: getPositionToScoreMap
import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
/**
* Returns a map PTM localization > score.
*
* @param peptide the peptide of interest
* @param noModPeptide the peptide without the variable modification of
* interest
* @param refPTM the PTM of interest
* @param annotationPreferences the global annotation preferences
* @param specificAnnotationPreferences the annotation preferences specific
* to this peptide and spectrum
* @param spectrumAnnotator the spectrum annotator which should be used to
* annotate the spectrum
* @param spectrum the spectrum of interest
* @param spectrumMap the map of the extracted spectra: depth > extracted
* spectrum
* @param possibleSites the possible modification sites
*
* @return a map PTM localization > score
*
* @throws org.apache.commons.math.MathException exception thrown whenever a
* math error occurred while computing the score or estimating the noise level
* @throws java.lang.InterruptedException exception thrown if the thread is
* interrupted
*/
public static HashMap<Integer, HashMap<Integer, Double>> getPositionToScoreMap(Peptide peptide, Peptide noModPeptide, ArrayList<Integer> possibleSites,
MSnSpectrum spectrum, HashMap<Integer, MSnSpectrum> spectrumMap, AnnotationSettings annotationPreferences, SpecificAnnotationSettings specificAnnotationPreferences, PeptideSpectrumAnnotator spectrumAnnotator, PTM refPTM) throws MathException, InterruptedException {
HashMap<Integer, HashMap<Integer, Double>> positionToScoreMap = new HashMap<Integer, HashMap<Integer, Double>>();
int N = 0;
for (ArrayList<Ion> fragmentIons : spectrumAnnotator.getExpectedIons(specificAnnotationPreferences, peptide).values()) {
N += fragmentIons.size();
}
String sequence = noModPeptide.getSequence();
int sequenceLength = sequence.length();
for (int i = 0; i < spectrumMap.size(); i++) {
double p = ((double) i + 1) / 100;
for (int pos : possibleSites) {
Peptide tempPeptide = new Peptide(noModPeptide.getSequence(), noModPeptide.getModificationMatches());
int position;
if (pos == 0) {
position = 1;
} else if (pos == sequenceLength + 1) {
position = sequenceLength;
} else {
position = pos;
}
tempPeptide.addModificationMatch(new ModificationMatch(refPTM.getName(), true, position));
ArrayList<IonMatch> matches = spectrumAnnotator.getSpectrumAnnotation(annotationPreferences, specificAnnotationPreferences,
spectrumMap.get(i), tempPeptide, false);
int n = matches.size();
BinomialDistribution distribution = new BinomialDistribution(N, p);
Double bigP = distribution.getDescendingCumulativeProbabilityAt((double) n);
Double score = -10 * MathUtils.log(10, bigP);
HashMap<Integer, Double> scoresAtPosition = positionToScoreMap.get(pos);
if (scoresAtPosition == null) {
scoresAtPosition = new HashMap<Integer, Double>(2);
positionToScoreMap.put(pos, scoresAtPosition);
}
scoresAtPosition.put(i + 1, score);
}
}
return positionToScoreMap;
}
示例3: getPTMPlotData
import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的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;
}
示例4: getAllSpectrumMatches
import com.compomics.util.experiment.biology.Peptide; //导入方法依赖的package包/类
@Override
public LinkedList<SpectrumMatch> getAllSpectrumMatches(WaitingHandler waitingHandler, SearchParameters searchParameters,
SequenceMatchingPreferences sequenceMatchingPreferences, boolean expandAaCombinations)
throws IOException, IllegalArgumentException, SQLException, ClassNotFoundException, InterruptedException, JAXBException {
String mgfFile = Util.removeExtension(fileName) + ".mgf"; //@TODO: make this generic?
LinkedList<SpectrumMatch> result = new LinkedList<SpectrumMatch>();
HashMap<String, SpectrumMatch> spectrumMatchesMap = new HashMap<String, SpectrumMatch>();
BufferedRandomAccessFile bufferedRandomAccessFile = new BufferedRandomAccessFile(resultsFile, "r", 1024 * 100);
if (waitingHandler != null) {
waitingHandler.setMaxSecondaryProgressCounter(100);
}
long progressUnit = bufferedRandomAccessFile.length() / 100;
String line, title = null;
SpectrumMatch spectrumMatch = null;
int rank = 0;
boolean firstSpectrum = false;
while ((line = bufferedRandomAccessFile.readLine()) != null) {
if (line.startsWith(">")) {
if (!firstSpectrum) {
firstSpectrum = true;
}
title = line.substring(1);
// remove any html from the title
title = URLDecoder.decode(title, "utf-8");
spectrumMatch = null;
long currentIndex = bufferedRandomAccessFile.getFilePointer();
if (waitingHandler != null) {
waitingHandler.setSecondaryProgressCounter((int) (currentIndex / progressUnit));
}
} else if (firstSpectrum) {
if (spectrumMatch == null) {
String spectrumKey = Spectrum.getSpectrumKey(mgfFile, title);
spectrumMatch = spectrumMatchesMap.get(spectrumKey);
rank = 0; // the rank is here per charge
if (spectrumMatch == null) {
spectrumMatch = new SpectrumMatch(Spectrum.getSpectrumKey(mgfFile, title));
result.add(spectrumMatch);
spectrumMatchesMap.put(spectrumKey, spectrumMatch);
}
}
rank++;
PeptideAssumption peptideAssumption = getAssumptionFromLine(line, rank);
if (expandAaCombinations && AminoAcidSequence.hasCombination(peptideAssumption.getPeptide().getSequence())) {
Peptide peptide = peptideAssumption.getPeptide();
ArrayList<ModificationMatch> previousModificationMatches = peptide.getModificationMatches(),
newModificationMatches = null;
if (previousModificationMatches != null) {
newModificationMatches = new ArrayList<ModificationMatch>(previousModificationMatches.size());
}
for (StringBuilder expandedSequence : AminoAcidSequence.getCombinations(peptide.getSequence())) {
Peptide newPeptide = new Peptide(expandedSequence.toString(), newModificationMatches, true);
if (previousModificationMatches != null) {
for (ModificationMatch modificationMatch : previousModificationMatches) {
newPeptide.addModificationMatch(new ModificationMatch(modificationMatch.getTheoreticPtm(), modificationMatch.isVariable(), modificationMatch.getModificationSite()));
}
}
PeptideAssumption newAssumption = new PeptideAssumption(newPeptide, peptideAssumption.getRank(), peptideAssumption.getAdvocate(), peptideAssumption.getIdentificationCharge(), peptideAssumption.getScore(), peptideAssumption.getIdentificationFile());
spectrumMatch.addHit(Advocate.andromeda.getIndex(), newAssumption, true);
}
} else {
spectrumMatch.addHit(Advocate.andromeda.getIndex(), peptideAssumption, true);
}
}
}
return result;
}