SearchParameters searchParameters, ArrayList<String> proteinKeys, ArrayList<String> peptideKeys, ArrayList<String> psmKeys,
String proteinMatchKey, int nSurroundingAA, AnnotationPreferences annotationPreferences, SequenceMatchingPreferences sequenceMatchingPreferences, IdFilter idFilter,
PTMScoringPreferences ptmcoringPreferences, SpectrumCountingPreferences spectrumCountingPreferences, WaitingHandler waitingHandler)
throws IOException, IllegalArgumentException, SQLException, ClassNotFoundException, InterruptedException, MzMLUnmarshallerException, MathException {
ExportWriter exportWriter = ExportWriter.getExportWriter(exportFormat, destinationFile, exportScheme.getSeparator(), exportScheme.getSeparationLines());
if (exportWriter instanceof ExcelWriter) {
ExcelWriter excelWriter = (ExcelWriter) exportWriter;
PsExportStyle exportStyle = PsExportStyle.getReportStyle(excelWriter);
excelWriter.setWorkbookStyle(exportStyle);
}
exportWriter.writeMainTitle(exportScheme.getMainTitle());
for (String sectionName : exportScheme.getSections()) {
if (exportScheme.isIncludeSectionTitles()) {
exportWriter.startNewSection(sectionName);
} else {
exportWriter.startNewSection();
}
if (sectionName.equals(PsAnnotationFeature.type)) {
PsAnnotationSection section = new PsAnnotationSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(annotationPreferences, waitingHandler);
} else if (sectionName.equals(PsInputFilterFeature.type)) {
PsInputFilterSection section = new PsInputFilterSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(idFilter, waitingHandler);
} else if (sectionName.equals(PsPeptideFeature.type)) {
PsPeptideSection section = new PsPeptideSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, sequenceMatchingPreferences, peptideKeys, nSurroundingAA, "", exportScheme.isValidatedOnly(), exportScheme.isIncludeDecoy(), waitingHandler);
} else if (sectionName.equals(PsProjectFeature.type)) {
PsProjectSection section = new PsProjectSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(experiment, sample, replicateNumber, projectDetails, waitingHandler);
} else if (sectionName.equals(PsProteinFeature.type)) {
PsProteinSection section = new PsProteinSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, sequenceMatchingPreferences, psmKeys, nSurroundingAA, exportScheme.isValidatedOnly(), exportScheme.isIncludeDecoy(), waitingHandler);
} else if (sectionName.equals(PsPsmFeature.type)) {
PsPsmSection section = new PsPsmSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, sequenceMatchingPreferences, psmKeys, "", exportScheme.isValidatedOnly(), exportScheme.isIncludeDecoy(), waitingHandler);
} else if (sectionName.equals(PsIdentificationAlgorithmMatchesFeature.type)) {
PsIdentificationAlgorithmMatchesSection section = new PsIdentificationAlgorithmMatchesSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, sequenceMatchingPreferences, psmKeys, "", waitingHandler);
} else if (sectionName.equals(PsPtmScoringFeature.type)) {
PsPtmScoringSection section = new PsPtmScoringSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(ptmcoringPreferences, waitingHandler);
} else if (sectionName.equals(PsSearchFeature.type)) {
PsSearchParametersSection section = new PsSearchParametersSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(searchParameters, waitingHandler);
} else if (sectionName.equals(PsSpectrumCountingFeature.type)) {
PsSpectrumCountingSection section = new PsSpectrumCountingSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
section.writeSection(spectrumCountingPreferences, waitingHandler);
} else if (sectionName.equals(PsValidationFeature.type)) {
PsValidationSection section = new PsValidationSection(exportScheme.getExportFeatures(sectionName), exportScheme.isIndexes(), exportScheme.isHeader(), exportWriter);
PSMaps psMaps = new PSMaps();
psMaps = (PSMaps) identification.getUrParam(psMaps);
section.writeSection(psMaps, waitingHandler);
} else {
throw new UnsupportedOperationException("Sectrion " + sectionName + " not implemented.");
}
}
exportWriter.close();
}