writer.write(prec.getRt() + SEPARATOR);
writer.write(bestAssumption.getPeptide().getMass() + SEPARATOR);
writer.write(bestAssumption.getDeltaMass(prec.getMz(), peptideShakerGUI.getSearchParameters().isPrecursorAccuracyTypePpm()) + SEPARATOR);
writer.write(bestAssumption.getIsotopeNumber(prec.getMz()) + SEPARATOR);
writer.write(psParameter.getPsmConfidence() + SEPARATOR);
MatchValidationLevel matchValidationLevel = psParameter.getMatchValidationLevel();
writer.write(matchValidationLevel.toString());
if (matchValidationLevel == MatchValidationLevel.doubtful && !psParameter.getReasonDoubtful().equals("")) {
writer.write(" (" + psParameter.getReasonDoubtful() + ")");
}
writer.write(SEPARATOR);
if (bestAssumption.getPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences())) {
writer.write(1 + SEPARATOR);
} else {
writer.write(0 + SEPARATOR);
}
writer.write(System.getProperty("line.separator"));
progressDialog.increasePrimaryProgressCounter();
}
}
writer.close();
try {
File outputFile = new File(selectedFile.getParent(), reducedName + "_Proteins_phospho.txt");
writer = new BufferedWriter(new FileWriter(outputFile));
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "An error occurred when saving the protein details.", "Saving Failed", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
return;
}
ArrayList<String> targetedPtms = new ArrayList<String>();
for (String ptm : ptmProfile.getAllNotFixedModifications()) {
if (ptm.contains("phospho")) {
targetedPtms.add(ptm);
}
}
writer.write(SEPARATOR);
writer.write("Accession" + SEPARATOR);
writer.write("Other Protein(s)" + SEPARATOR);
writer.write("Protein Inference Class" + SEPARATOR);
writer.write("Description" + SEPARATOR);
writer.write("Sequence Coverage (%)" + SEPARATOR);
writer.write("Observable Coverage (%)" + SEPARATOR);
writer.write("Confident Phosphorylation Sites" + SEPARATOR);
writer.write("# Confident" + SEPARATOR);
writer.write("Other Phosphorylation Sites" + SEPARATOR);
writer.write("# Other" + SEPARATOR);
writer.write("#Validated Peptides" + SEPARATOR);
writer.write("#Validated Spectra" + SEPARATOR);
writer.write("NSAF" + SEPARATOR);
writer.write("MW (kDa)" + SEPARATOR);
writer.write("Confidence" + SEPARATOR);
writer.write("Validation" + SEPARATOR);
writer.write("Decoy" + SEPARATOR);
writer.write(System.getProperty("line.separator"));
PSParameter proteinPSParameter = new PSParameter();
int proteinCounter = 0;
progressDialog.setTitle("Loading Protein Matches. Please Wait...");
identification.loadProteinMatches(progressDialog);
progressDialog.setTitle("Loading Protein Details. Please Wait...");
identification.loadProteinMatchParameters(proteinPSParameter, progressDialog);
progressDialog.setPrimaryProgressCounterIndeterminate(false);
progressDialog.setMaxPrimaryProgressCounter(identification.getProteinIdentification().size());
progressDialog.setValue(0);
progressDialog.setTitle("Copying Protein Phospho Details to File. Please Wait...");
for (String proteinKey : identification.getProteinIdentification()) {
if (progressDialog.isRunCanceled()) {
break;
}
proteinPSParameter = (PSParameter) identification.getProteinMatchParameter(proteinKey, proteinPSParameter);
writer.write(++proteinCounter + SEPARATOR);
ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
String accession = proteinMatch.getMainMatch();
writer.write(accession + SEPARATOR);
boolean first = true;
for (String otherProtein : proteinMatch.getTheoreticProteinsAccessions()) {
if (!otherProtein.equals(accession)) {
if (first) {
first = false;
} else {
writer.write(", ");
}
writer.write(otherProtein);
}
}
writer.write(SEPARATOR);
writer.write(proteinPSParameter.getProteinInferenceClassAsString() + SEPARATOR);
try {
writer.write(sequenceFactory.getHeader(proteinMatch.getMainMatch()).getSimpleProteinDescription() + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
try {
HashMap<Integer, Double> sequenceCoverage;
try {
sequenceCoverage = peptideShakerGUI.getIdentificationFeaturesGenerator().getSequenceCoverage(proteinKey);
} catch (Exception e) {
peptideShakerGUI.catchException(e);
sequenceCoverage = new HashMap<Integer, Double>();
}
Double sequenceCoverageConfident = 100 * sequenceCoverage.get(MatchValidationLevel.confident.getIndex());
Double sequenceCoverageDoubtful = 100 * sequenceCoverage.get(MatchValidationLevel.doubtful.getIndex());
Double validatedCoverage = sequenceCoverageConfident + sequenceCoverageDoubtful;
writer.write(validatedCoverage + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
try {
writer.write(peptideShakerGUI.getIdentificationFeaturesGenerator().getObservableCoverage(proteinKey) * 100 + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
try {
writer.write(peptideShakerGUI.getIdentificationFeaturesGenerator().getConfidentPtmSites(proteinKey, targetedPtms) + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
try {
writer.write(peptideShakerGUI.getIdentificationFeaturesGenerator().getAmbiguousPtmSites(proteinKey, targetedPtms) + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
try {
writer.write(peptideShakerGUI.getIdentificationFeaturesGenerator().getNValidatedPeptides(proteinKey) + SEPARATOR);
} catch (Exception e) {
peptideShakerGUI.catchException(e);
writer.write(Double.NaN + SEPARATOR);
}
try {
writer.write(peptideShakerGUI.getIdentificationFeaturesGenerator().getNValidatedSpectra(proteinKey) + SEPARATOR);
} catch (Exception e) {
peptideShakerGUI.catchException(e);
writer.write(Double.NaN + SEPARATOR);
}
try {
writer.write(peptideShakerGUI.getIdentificationFeaturesGenerator().getSpectrumCounting(proteinKey,
SpectrumCountingPreferences.SpectralCountingMethod.NSAF) + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
try {
Double proteinMW = sequenceFactory.computeMolecularWeight(proteinMatch.getMainMatch());
writer.write(proteinMW + SEPARATOR);
} catch (Exception e) {
writer.write("error: " + e.getLocalizedMessage() + SEPARATOR);
}
writer.write(proteinPSParameter.getProteinConfidence() + SEPARATOR);
MatchValidationLevel matchValidationLevel = proteinPSParameter.getMatchValidationLevel();
writer.write(matchValidationLevel.toString());
if (matchValidationLevel == MatchValidationLevel.doubtful && !proteinPSParameter.getReasonDoubtful().equals("")) {
writer.write(" (" + proteinPSParameter.getReasonDoubtful() + ")");
}
writer.write(SEPARATOR);
if (proteinMatch.isDecoy()) {