if (accessions == null) {
accessions = peptide.getParentProteins(sequenceMatchingPreferences);
}
PTMFactory ptmFactory = PTMFactory.getInstance();
PtmToPrideMap ptmToPrideMap = null;
// get the psi-mod mappings
try {
PrideObjectsFactory prideObjectsFactory = PrideObjectsFactory.getInstance();
ptmToPrideMap = prideObjectsFactory.getPtmToPrideMap();
} catch (Exception e) {
e.printStackTrace();
}
for (String accession : accessions) {
PeptideSpectrumAnnotator spectrumAnnotator = new PeptideSpectrumAnnotator();
ArrayList<IonMatch> annotations = spectrumAnnotator.getSpectrumAnnotation(
annotationPreferences.getIonTypes(),
annotationPreferences.getNeutralLosses(),
annotationPreferences.getValidatedCharges(),
spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value,
spectrum,
spectrumMatch.getBestPeptideAssumption().getPeptide(),
spectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
annotationPreferences.getFragmentIonAccuracy(), false,
annotationPreferences.isHighResolutionAnnotation());
for (IonMatch ionMatch : annotations) {
if (ionMatch.ion.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION) {
PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ionMatch.ion;
if (peptideFragmentIon.getNeutralLosses().isEmpty()) {
//Q1
Charge charge = bestAssumption.getIdentificationCharge();
double theoreticPrecMz = (peptide.getMass() + charge.value * ElementaryIon.proton.getTheoreticMass()) / charge.value;
writer.write(theoreticPrecMz + SEPARATOR);
//Q3
double theoreticFragMz = ionMatch.ion.getTheoreticMz(charge.value);
writer.write(theoreticFragMz + SEPARATOR);
// RT_detected
double rt = spectrum.getPrecursor().getRt();
writer.write(rt + SEPARATOR);
// isotope
writer.write("Light" + SEPARATOR);
// uniprot_id
writer.write(accession + SEPARATOR);
// relative intensity
double intensity = ionMatch.peak.intensity; //@TODO: normalize in some way?
writer.write(intensity + SEPARATOR);
// sequence
String sequence = peptide.getSequence();
writer.write(sequence + SEPARATOR);
// modified sequence
String modifiedSequence = "";
for (int aa = 0; aa < sequence.length(); aa++) {
modifiedSequence += sequence.charAt(aa);
for (ModificationMatch modificationMatch : peptide.getModificationMatches()) {
if (modificationMatch.getModificationSite() == aa + 1) {
String ptmName = modificationMatch.getTheoreticPtm();
PTM ptm = ptmFactory.getPTM(ptmName);
CvTerm cvTerm = null;
if (ptmToPrideMap != null) {
try {
cvTerm = ptmToPrideMap.getCVTerm(ptmName);
if (cvTerm == null) {
cvTerm = PtmToPrideMap.getDefaultCVTerm(ptmName);
}
} catch (Exception e) {
}